Welcome To Snipplr
Everyone's Recent Snippets
- All /
- JavaScript /
- HTML /
- PHP /
- CSS /
- Ruby /
- Objective C
PHP
Sending multipart/alternative (text and html both together) email messages from PHP directly via sendmail
sendmail needs to be working and configured properly
uses popen and fputs
0
2742
posted 17 years ago by acosonic
e.g.
<pre><code>
$ twlogmerge.py twitter-log-user-dir
read file: twitter-log-user-dir/page001.xml
get status: id: 123456789
append status: accum.:1234
...
append status: accum.:3456
write file: twitter-log-user-dir-marged-20090828-130146.xml...
0
1828
posted 17 years ago by mustam
This is xslt file for twitter-logged xml file.
* cf. [Backup my twitter-log](http://snipplr.com/view/18925/backup-my-twitterlog/)
* cf. [Merge twitter-logged files into one xml-file](http://snipplr.com/view/18928/merge-twitterlogged-files...
0
4223
posted 17 years ago by mustam
e.g.
<pre>
$ twlog.py user
twitter account name: user
Now logging start, take several times. r u OK? [y/N]: y
DEBUG: make dir: twitter-log-user
DEBUG: get log: page=1
DEBUG: new tweet: 21, accum. tweet: 21
DEBUG: remain hits: 149
DEBUG: writ...
1
1618
posted 17 years ago by mustam
Page_ClientValidate is a global function. When called this will return true/false if the validator group provided is valid or not.
0
1936
posted 17 years ago by jink
This is a quick & dirty helper for pumping out those annoying little link sharing URLS. I've kept it simple, so all it does is return a URL formatted for a particular service.
To use it, just pass a string of the service name to the helper followe...
1
1925
posted 17 years ago by brettbergeron
Dumps whole query so developer can see where is error. However it's potential security issue, exposing SQL commands to attacker. (Recommended to use only during development, replace message code with some custom error text)
0
2291
posted 17 years ago by acosonic
Usage:
//any element
window.onload = function(){
focusFirstInput();
}
or
// form elements under 'content-body'
window.onload = function(){
focusFirstInput('content-body');
}
0
1896
posted 17 years ago by neoprolog
Usually use in a template with `in_category()`, like `if ( in_category( 3 ) || in_subcategory( 3 ) ) { ...`. Tested in WP 2.8.4.
1
2087
posted 17 years ago by cyberhobo
The code below will loop through the properties in an object and alert a string. myObject is in JSON notation. The "for ( x in y)" construct does not work if the Prototype.js library is included on the page
0
3729
posted 17 years ago by elugardo
Below are two functions I've been using to make event tracking a little easier in CodeIgniter.
Two functions are available, google_analytics() & track_event().
google_analytics() takes one argument and uses it as the UA code for your tracking p...
5
2644
posted 17 years ago by brettbergeron
The below code helps you move your site assets (images, css, javascript) to a public folder inside the application directory of CodeIgniter.
One thing you'll need to do is define ASSETPATH to be the path to the location of your public items. For m...
1
1856
posted 17 years ago by brettbergeron
A simple class layout template that I always use to get me started.
Nothing fancy. Just your basic structure.
1
2082
posted 17 years ago by StrawMan
Useful in cases where the object author has specified their own serialization that doesn't work for you.
1
2246
posted 17 years ago by rengber
How to concatenate lists, add an item to a list, slice an item from a list.
0
1726
posted 17 years ago by chrisaiv
This piece of code will store each line of a txt file into a mysql database
2
2700
posted 17 years ago by fackz
This approach allows an application to be embedded in a DLL. This is handy for diagnostic/maintenance utilities that are used with the DLL.
Steps to create:
* Create a MFC DLL project
* Add a dialog
* Add an entry point function such as void CA...
0
3675
posted 17 years ago by jimfred