Welcome To Snipplr


Everyone's Recent Snippets Tagged c



1 ... 440 441 442 443 444 ... 552
I use this snippet to force a number to 2 decimal places. Eg, For prices, PHP rounds the number 22.20 to 22.2. This code forces a zero on the end if there isn't 2 decimal places already.
1 2102 posted 17 years ago by xtheonex
This little piece of code will convert to US phone format, as typed. Eg, As the number "0000000000" was typed, it would convert it to (000)-000-0000.
6 5482 posted 17 years ago by xtheonex
Function to return the current page name, without the location of it... Eg, for the URL http://localhost/www/someproject/index.php, this would return index.php
1 1811 posted 17 years ago by xtheonex
A quick, usefull function which i use to convert a date/time string pulled from MySQL, into a readable format.
1 2014 posted 17 years ago by xtheonex
This is by no means the most efficient way to do this, in terms of performance. It is however the easiest way.
1 2087 posted 17 years ago by xtheonex
Won't work with Google code pages: they are javascript powered.
0 1977 posted 17 years ago by iblis
How to run a KVM VM with no X (server environment, originally seen at http://blog.bodhizazen.net/?p=40).
0 1909 posted 17 years ago by narkisr
I just figured out that TextExpander can execute AppleScripts. This is an experiment.
1 1714 posted 17 years ago by ttscoff
simple way to join avi files on the command line (need to have mplayer installed)
0 1904 posted 17 years ago by inkdeep
Clear files in /tmp directory that are older than three days - terminal/cron this is a very simple example - could also remove by last access time, etc.
0 1912 posted 17 years ago by inkdeep
I had a directory tree with around 4000 pdf files and I needed a page count - so I semi-rolled this. I swiped the counter code from the gem README: http://github.com/yob/pdf-reader/tree/master It could be more contained - as is I run it from irb:...
1 2833 posted 17 years ago by inkdeep
0 1897 posted 17 years ago by vasilije
Use with (in custom.css) .sidebar_box {margin-bottom:2em; text-align:center;} You may have to adjust the width for your sidebars.
2 2390 posted 17 years ago by kristarella
This is the javascript code that enables you to create hover effects also in IE6. It's clean, it's light, it's super! :) Apply that code to your document (eg. in <head></head>) and in css add like this: ul li:hover, ul li.shover { your css st...
1 2337 posted 17 years ago by mihael
2 2281 posted 17 years ago by rwczippy
I've used Textmate since I started hand-coding websites. My boss loves BBEdit. This script allows me to do the thing I missed most from Textmate creating and wrapping tags around text. Enjoy!
2 2320 posted 17 years ago by conspirator
1 1719 posted 17 years ago by ping_ch
Add class \"clear\" to elements that contain floated elements and they will hold the height correctly
2 1634 posted 17 years ago by mihael
This example shows how to clean up git's reflogs entries in order save space (see http://www.newartisans.com/blog/2008/04/diving-into-git.html).
0 3303 posted 17 years ago by narkisr
The function content should work in any theme, it's just wrapped in a function wrapper for insertion into the Thesis theme.
2 2306 posted 17 years ago by kristarella
This CSS is nice to use with this function: .custom .avatar {float:left; border:3px solid #ddd; margin-right:1em;}
2 2045 posted 17 years ago by kristarella
You will probably have to hide the medium sized image.
2 2171 posted 17 years ago by kristarella
1 ... 440 441 442 443 444 ... 552