Welcome To Snipplr
Everyone's Recent Snippets
- All /
- JavaScript /
- HTML /
- PHP /
- CSS /
- Ruby /
- Objective C
Read a page's GET URL variables and return them as an associative array.
----
Example for URL http://www.example.com/index.html?hello=bonjour&goodevening=bonsoir
var hash = getUrlVars();
alert(hash['hello']); // prints 'bonjour'
alert(hash...
        
        
        
            35 
        
        
            13462 
        
                    posted 19 years ago by Roshambo
            To assert the difference in values before and after some code blocks.  Save this as assert_helper.rb and include it in your test_helper.rb
        
        
        
            1 
        
        
            1087 
        
                    posted 19 years ago by ctran
            Una breve referencia de los meta carácteres y su significado en expresiones regulares en PHP.
Esta referencia de expresiones regulares es muy interesante para tener a mano. Está recogida de un comentario del manual de php.net.
        
        
        
            4 
        
        
            1571 
        
                    posted 19 years ago by Navegante
            Simple templating for innerHTML functions. Parses an input string (tmpl) for %(NAME) tokens, accepts an object (ns) as data and returns an output string.
        
        
        
            1 
        
        
            1206 
        
                    posted 19 years ago by mattgay
            The ideal use of this code would be to save the Javascript code as a .js file.  Then use the HTML code at the bottom to call it wherever you want on the web page.
        
        
        
            1 
        
        
            1418 
        
                    posted 19 years ago by Jaymoon
            (Applies to the HTML_Template_IT PEAR package)
Useful script to find all global variables and put them
in a format for an array. $t is the HTML_Template_IT(X) object.
        
        
        
            0 
        
        
            1846 
        
                    posted 19 years ago by pckujawa
            The form method must be post and the enctype set as it is below. The hidden input for MAX_FILE_SIZE must also be included. The value is the max file size (in bytes?).
        
        
        
            4 
        
        
            1557 
        
                    posted 19 years ago by pckujawa
            Use to redirect an html page after headers have already been sent. The 5 is the number of seconds before redirect to the URL.
        
        
        
            1 
        
        
            1268 
        
                    posted 19 years ago by pckujawa
            Recorta el texto recibido al limite especificado de caracteres.
Caracteristicas:
  * Si el texto es HTML el texto no contendra tags incompletos
  * Si el texto no es HTML no se recortaran palabras
Notas: Se debe tener en cuenta que el texto pod...
        
        
        
            1 
        
        
            1050 
        
                    posted 19 years ago by Navegante
            Elimina las etiquetas de párrafo <P< y </P< (sin parámetros) y las sustituye por saltos de línea <BR />.
En caso necesario inserta un <BR /> adicional para simular la separación de párrafos.
        
        
        
            0 
        
        
            1260 
        
                    posted 19 years ago by Navegante
            Performance can be seen in link.  This code, however, uses generator expression instead of list comprehension.
        
        
        
            1 
        
        
            1345 
        
                    posted 19 years ago by newtonapple
            Took 0.164692 seconds for array[]
Took 0.395778 seconds for array_push
As you can see array_push is more than twice as slow. Here are the reasons. Array_push is a function call, Function calls are always slower. Array_push takes mixed parameters,...
        
        
        
            0 
        
        
            4550 
        
                    posted 19 years ago by mthorn
            strcmp with matching strings took 0.207852 seconds
strcmp with non-matching strings took 0.215276 seconds
=== with matching strings took 0.067122 seconds
=== with non-matching strings took 0.057305 seconds
=== is the clear winner. Function call...
        
        
        
            0 
        
        
            3205 
        
                    posted 19 years ago by mthorn
            Often PHP can't interpret POST data because it is not form-encoded. This is typical when the post data is XML from API's like Flash's XmlSocket. You can use the following methods to read the POST data directly.
        
        
        
            1 
        
        
            2435 
        
                    posted 19 years ago by mthorn
            Since PHP is typeless odd things can happen when a variable is not the type you expected. PHP treats 0, null, '0', false, and '' as false. Sometimes you really want to know if the value is false. The solution is simple, use the triple equal (===) ope...
        
        
        
            0 
        
        
            1502 
        
                    posted 19 years ago by mthorn
            Will create a thumnail no taller or wider than the supplied size. Also contains some tips for reading and writing images using GD.
        
        
        
            22 
        
        
            16294 
        
                    posted 19 years ago by mthorn
            Sends as XHTML 1.1 + MathML if supported, falls back to XHTML 1.1 if supported, or falls back to HTML 4.01 Strict.
Mixed two separate scripts:
http://www.workingwith.me.uk/articles/scripting/mimetypes
http://golem.ph.utexas.edu/~distler/blog/arc...
        
        
        
            2 
        
        
            1112 
        
                    posted 19 years ago by rolandog
            Save this snippet via Safari as webarchive and replace an already created signature with this webarchive. Signatures are stored under ~/Library/Mail/Signatures
        
        
        
            2 
        
        
            1723 
        
                    posted 19 years ago by AlexK
            Great little debuging snippet found while browsing. The code adds different coloured borders to the assets depending on its level. Leave commented out if not needed.
        
        
        
            96 
        
        
            12620 
        
                    posted 19 years ago by 1man
            For bin iso you also need cdemu
To convert between formats check: mdf2iso, nrg2iso and ccd2iso
        
        
        
            3 
        
        
            2769 
        
                    posted 19 years ago by yuconner
            To make an ISO from your CD/DVD, place the media in your drive but do not mount it. If it automounts, unmount it.
        
        
        
            0 
        
        
            1252 
        
                    posted 19 years ago by yuconner
            
