Welcome To Snipplr
Everyone's Recent Snippets
- All /
- JavaScript /
- HTML /
- PHP /
- CSS /
- Ruby /
- Objective C
found this on the adobe cookbook site. There is also some PHP to go along with this in my snippets.
1
3509
posted 17 years ago by mswallace
/* if (globalVariable) {
But this wouldn't work. That code is actually checking to see if the defined variable globalVariable has a null value. If the variable has not been defined, that code will cause an error.
Instead, here is the code that...
0
941
posted 17 years ago by zha
You can store an IP address in an INT UNSIGNED (4 bytes) which is of course much more efficient and faster than a CHAR(15).
MySQL has two built-in functions: INET_ATON() and INET_NTOA(). These two functions are used allover the place in any TCP/IP s...
0
1625
posted 17 years ago by zingo
Worst title ever. Basically, this takes a string like:
"Check this out: http://snipplr.com/view/5759/replace-a-url-its-domain-name-and-create-link/" and replaces it with "Check this out: snipplr.com [with a link to the full URL]"
1
1767
posted 17 years ago by jaytee
This bit of code allows you to turn code that looks like this:
x = {'foo':1, 'bar':2 }
x['foo'] = 3
Into this:
x = dictclass( {'foo':1, 'bar':2 } )
x.foo = 3
2
1383
posted 17 years ago by kangell
Below is some code written for creating one response from survey questions where the respondent checks all that apply.
0
3444
posted 17 years ago by webonomic
Flash sucks, embedding it sucks more, find out how to make it not suck.
2
2490
posted 17 years ago by neal_grosskopf
Start mplayer with -vf screenshot, and press 's' when you want to capture a
frame.
0
1126
posted 17 years ago by mandric
I often find something like this lurking at the end of my base templates - it'll show you which queries were run while generating the current page, but they'll start out hidden so as not to be a pain.
Of course, before this works, you'll need to s...
1
1546
posted 17 years ago by jonhenshaw
Run the specified command. If expect is not None then look for the given text in the output. If it is not there we throw an error. expect can also be a list of strings. In that case any match results in success unless matchall=True.
0
1038
posted 17 years ago by kangell
Instead of using this function to set the default timezone in your script, you can also use the INI setting date.timezone to set the default timezone.
* Does not affect timestamp functions, which are all GMT
0
1292
posted 17 years ago by johnself
Check out the bash command 'shopt -s cdable_vars' From the man bash page: If set, an argument to the cd builtin command that is not a directory is assumed to be the name of a variable whose value is the directory to change to.
0
1079
posted 17 years ago by cczona
This class var creates a belongsTo association between this and another Model
1
1020
posted 17 years ago by jesse
This class var definition configures a Model to have a OneToOne relationship with a Model of another class.
1
1019
posted 17 years ago by jesse