Top

Code Snippets by Hawkee

  (25)  
Sort by 
This is a sample javascript gadget. It only displays text, but it uses the gadget syntax referenced on Google: http://code.google.com/apis/gadgets/docs/gs.html So far we support gadgets and are
Tags: gadget 
1 comment(s)   |   Score: 0.0   |   Language: OpenSocial   |   Posted by Hawkee on Apr 01, 2008
This is a little snippet that will remove any non-ASCII characters from a string.
Tags: ascii  pregreplace  strip 
0 comment(s)   |   Score: 0.0   |   Language: PHP   |   Posted by Hawkee on Mar 31, 2008
This code produces a sort box for any number of arbitrary criteria on any type of data you have in your database. For this particular example we've got a product sort where users can sort by price or
Tags: database  mysql  search  sort 
1 comment(s)   |   Score: 9.0   |   Language: PHP   |   Posted by Hawkee on Mar 24, 2008
This is a very simple PHP snippet that will set $title, $meta_keywords and $meta_description for use in your page header. You'll need to create meta_tags.txt which will use this format: page_name.html|page
Tags: dynamic  keywords  meta  php  tags  title 
4 comment(s)   |   Score: 4.0   |   Language: PHP   |   Posted by Hawkee on Dec 10, 2007
This will extract a zip file via PHP. Just be sure to set the $file and $path variables. $file represents the zip file name which may or may not contain a path. $path represents the directory to extract
Tags: file  gunzip  unzip 
6 comment(s)   |   Score: 9.0   |   Language: PHP   |   Posted by Hawkee on Jun 21, 2007
This is a very handy command line use of perl. You basically execute the s// function of perl on a handful of files to do a global search and replace. Just run this from the command line and indicate
Tags: perl  replace  search 
1 comment(s)   |   Score: 0.0   |   Language: Perl   |   Posted by Hawkee on Apr 13, 2007
This is more of a note to myself, but I use it to dump databases where there are additional fields in the new table. When you're upgrading a database you can either add the new fields to the old table
Tags: complete  insert 
0 comment(s)   |   Score: 0.0   |   Language: mySQL   |   Posted by Hawkee on Mar 28, 2007
This was used in our The display is either "none" if we don't need to show the "Full Review" link or "inline" which will make the dots appear after the cut-off text.
Tags: css  cut  end  long  php  string 
1 comment(s)   |   Score: 8.0   |   Language: Javascript   |   Posted by Hawkee on Mar 24, 2007
This will copy the text in a given field to the clipboard. Unfortunately it only works in IE, so Firefox users will still need to do the actual copy. But it'll at least select the text for Firefox users. Here
Tags: clipboard  copy 
1 comment(s)   |   Score: 7.0   |   Language: Javascript   |   Posted by Hawkee on Mar 24, 2007
I always need these for my CSS development. They're great for making your CSS more visible for debugging. You can include one or all in your main stylesheet and just apply the style to any div you're
Tags: border  css  styles 
2 comment(s)   |   Score: 0.0   |   Language: CSS   |   Posted by Hawkee on Mar 23, 2007
This can be used in conjunction with my snippet. The colors are what we use here at Hawkee, so please feel free to change them. If you find a scheme that works well post it as a snippet.
Tags: cloud  stylesheet  tagcloud  tags 
0 comment(s)   |   Score: 0.0   |   Language: CSS   |   Posted by Hawkee on Mar 21, 2007
This will assign font sizes to tags based on their counts. It tries to evenly distribute the font sizes among the tags while keeping all tags with the same counts under the same font size. The data needs
15 comment(s)   |   Score: 8.0   |   Language: PHP   |   Posted by Hawkee on Nov 18, 2005
I thought this was pretty neat and useful. You can combine strtotime with the date function to create your own date verbally. This is just an alternative to using mktime that's a little more intuiti
Tags: date  time  timestamp 
3 comment(s)   |   Score: 7.0   |   Language: PHP   |   Posted by Hawkee on Nov 02, 2005
This is a stand alone example of a review system. This is the administration page for entering and editing reviews. It'll create your table for you automatically, so all you need to do is change the
Tags: editor  mysql  php  review  score 
7 comment(s)   |   Score: 10.0   |   Language: PHP   |   Posted by Hawkee on Aug 24, 2005
This is a very simple Ruby snippet that creates an unnecessary function.
Tags: def  function  puts 
4 comment(s)   |   Score: 7.7   |   Language: Ruby / Rails   |   Posted by Hawkee on Aug 18, 2005
1 2 Next
Bottom