Skip to content

Instantly share code, notes, and snippets.

View SkyM's full-sized avatar
🔫
Revolutionizing the Firearms Industry

Sky SkyM

🔫
Revolutionizing the Firearms Industry
View GitHub Profile

Keybase proof

I hereby claim:

  • I am skym on github.
  • I am sky (https://keybase.io/sky) on keybase.
  • I have a public key ASBZNGF2pctkh7znZPGb9eVT5rai9mAEquN009PIiWlOhQo

To claim this, I am signing this object:

@SkyM
SkyM / short_code_generator.rb
Last active August 29, 2015 14:04
Short Code Generator
require "digest/md5"
module App
module Tools
class ShortCodeGenerator
attr_reader :max_code_length
def initialize(max_code_length)
if max_code_length < 2
raise "Code length needs to be a value of AT LEAST '2'!"
@SkyM
SkyM / gist:9238083
Created February 26, 2014 20:41
keybase.md
### Keybase proof
I hereby claim:
* I am skym on github.
* I am sky (https://keybase.io/sky) on keybase.
* I have a public key whose fingerprint is E33C B378 6984 63A7 0004 8301 9B97 5C85 B43C 7610
To claim this, I am signing this object:
@SkyM
SkyM / gist:2346236
Created April 9, 2012 20:04
Camel case to underscore and back
To convert camelCase to underscores, in TextMate, replace ([a-z])([A-Z]) with $1_\l$2
To convert underscores to camelCase, replace ([a-z]+)_([a-z]+) with $1\u$2
@SkyM
SkyM / gist:2061330
Created March 17, 2012 15:42
Hacker News Stylesheet Upgrade
body {
margin: 0;
background-image: url(http://subtlepatterns.com/patterns/groovepaper.png);
}
body > center > table {
width: 100%;
background-color: transparent;
}
@SkyM
SkyM / pre-commit
Created January 19, 2012 17:57
git pre-commit hook to stop bad words
#!/usr/bin/env ruby
FORBIDDEN = [
/\bdebugger\b/,
/\bfuck\b/,
/\bshit\b/,
/\bbitch\b/,
/\bwtf\b/,
/\bconsole\.debug\b/,
/\bLorem\.ipsum\.dolor\.sit\.amet\b/,
@SkyM
SkyM / gist:1347939
Created November 8, 2011 14:53
Terminal Git Status
###################
~/.bash_profile
###################
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*"
}
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/"
}
def self.import_data_from_quickbase
quickbase = QuickBase::Client.init("username" => QB_USERNAME, "password" => QB_PASSWORD, "apptoken" => QB_APP_TOKEN, "printRequestsAndResponses" => true)
#pull down the entire list of products like a boss
quickbase_products = quickbase.doQuery(QB_PRODUCTS_TABLE,nil, nil, nil, "1.2.3.4.6.7.13.17.55.63.82.92.114.115.128.131.11.132.54.133.134.8.127.135.136.137.138.139.140.141.143.144.145.146.147.148.149.150.151.152.153.154.155.156.157.12.158.159.160.161.162.163.164.165.166.167.10.168.169.170.16.171.172.9.184.185.186.187", nil, nil, nil )
product_count = quickbase_products.count
(0...product_count).each do |i|
puts "Doing #{i} / #{product_count}"
quickbase_product = quickbase_products[i]
product = Product.find_or_initialize_by_quickbase_record_id(:quickbase_record_id => quickbase_product.record_id_)
if product.id