Skip to content

Instantly share code, notes, and snippets.

View kfprimm's full-sized avatar

Kevin Primm kfprimm

  • Richmond, Virginia
View GitHub Profile
@kfprimm
kfprimm / DrawImage.bb
Last active April 18, 2017 22:47
Blitz3D -> C -> macOS
Graphics 800,600,32,2
SetBuffer BackBuffer()
img=LoadImage( "_release/samples/mak/b3dlogo.jpg" )
while Not KeyDown(1)
Cls
Color 255,255,255
@kfprimm
kfprimm / custom_route_key.rb
Created October 6, 2012 03:23
Allow custom keys to be used in polymorphic url generation.
module ActiveModel
class Name
alias_method :org_initialize, :initialize
def initialize(klass, namespace = nil, name = nil)
if klass.respond_to?(:route_key) && name.nil?
org_initialize(klass, namespace, klass.route_key)
else
org_initialize(klass, namespace, name)
end
end
@kfprimm
kfprimm / README.markdown
Created July 28, 2012 14:08 — forked from gudbergur/README.markdown
Bootstrap's Typeahead plugin extended (allowing for AJAX functionality) among other things

This is a fork of Bootstrap Typeahead that adds minimal but powerful extensions.

For example, process typeahead list asynchronously and return objects

  # This example does an AJAX lookup and is in CoffeeScript
  $('.typeahead').typeahead(
    # source can be a function
    source: (typeahead, query) ->
 # this function receives the typeahead object and the query string
@kfprimm
kfprimm / date.rb
Created October 19, 2011 15:55 — forked from troyk/date.rb
Date.parse() with Ruby 1.9 is now defaulting to the European date style, John Wayne would be sad, and our apps don't work right, so this fixes it
# Date.parse() with Ruby 1.9 is now defaulting to the European date style where the format is DD/MM/YYYY, not MM/DD/YYYY
# patch it to use US format by default
class Date
class << self
alias :euro_parse :_parse
def _parse(str,comp=false)
str = str.to_s.strip
if str == ''
{}
elsif str =~ /^(\d{1,2})[-\/](\d{1,2})[-\/](\d{2,4})/