Jeffrey Kohn - Developer, Cook, Geek

  • Home
  • About Me
  • Blog
    • Sunday Dinners
    • Bacon
    • Beer
    • Scotch
  • Recipes
    • Bacon
    • All Recipes
  • Code
  • Photos
  • Contact
Home

Recent Blog Posts

  • Sunday Dinner - Super Bowl
  • Top 5 pictures from my Flickr profile
  • Lunch?
  • Sunday Dinner - Oct 2
  • Sunday Dinner - Sept 25
  • Cheese Steak Stroganoff Sandwich
  • First Jalapeno from the garden
  • Peanut Butter & Bacon Sandwich
  • Burger
  • So Fly like cheesehead
more

Recent Recipes

  • Oven Roasted Pulled Pork Sandwiches
  • Banana Rum Egg Nog
  • bacon wrapped poutine stuffed chicken
  • Ultimate Ice Cream Sandwich
  • Gambas al Ajillo (Garlic Shrimp)
  • Sufganiyot 2
  • Candied Bacon, Maple Whipped Cream Donuts
  • Sufganiyot (Jelly Donuts)
  • French Toast Hot Dog
  • Chicken thai green curry
more

Code

Alpha Numeric Sequences

January 25, 2012

This function allows numbers using any given sequence of numbers or characters. The purpose of this code was to allows us to create larger numbers for row ids in the database but using less number of characters, this might create a larger footprint in the database since the size of one character is 8bits, while an 8bit integers gives you 255 numbers.

in this case the allowed numbers/characters give a numbering system in base62.

this was handy when creating URLs that use the row ID so a quick lookup in the database could be made without a conversion of bases. did not have the conversion functions when originally wrote it, but added them here.

  • alphanumeric
  • php
  • sequences
  • Add new comment
  • Read more

Ultimate Post Type Manager updated plugin fix

August 25, 2011

I recently updated the Ultimate Post Type Manager plugin. It is a great plugin that allows you to add new post types and add custom fields.

you can download it here:
http://wordpress.org/extend/plugins/ultimate-post-type-manager/

The plugin works great if you install it as a new plugin. However if you're updating the plugin from an older version somethings might not work.

  • plugin
  • worpress
  • Add new comment
  • Read more

Increasing number of values for a CCK field

December 16, 2010

A client needed to have more than the default number of value (10) and less than the most (unlimited).

This code modifies the content form by using hook_form_alter.

  • cck
  • Drupal
  • hook_form_alter
  • Add new comment
  • Read more

Javascript equivalent for PHP's microtime

August 21, 2009

I was doing some javascript dev and needed php's microtime function. I did find some on the Internet but they weren't giving the right results so i wrote my own

// http://jeffrey-kohn.com/code
//
Javascript equivalent for PHP's microtime
function microtime(get_as_float)
{
    var unixtime_ms = new Date().getTime();
    var sec = parseInt(unixtime_ms / 1000);
   
    return get_as_float ? (unixtime_ms/1000) : (unixtime_ms - (sec * 1000))/1000 + ' ' + sec;
}

  • javascript
  • php
  • Add new comment

Twitter
Facebook
Flickr

  • home
  • about me
  • blog
  • recipes
  • code
  • photos
  • contact