Skip to content

Instantly share code, notes, and snippets.

@kinsteronline
kinsteronline / gist:5256646
Created March 27, 2013 18:07
Does this work? Will this give me the ruby mocha like expectation? missle.expects(:launch).never
function callWatcher(fn) {
var called = false;
return function() {
if(!called) {
called = true;
}
return !called;
};
}
@kinsteronline
kinsteronline / app.py
Created January 23, 2013 16:04
A sample flask app
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from template_app import settings
from template_app.core import setup_routing
# setup application
app = Flask('template_app')
app.config.from_object(settings)
doctype 5
html
head
meta(charset='utf-8')
title= title
block css
body
block content
block js
@kinsteronline
kinsteronline / fairly_standard.rb
Created December 20, 2012 16:57
Rails template that includes mysql, rspec, guard and fabrication.
gem 'unicorn'
gem_group :development, :test do
gem 'rspec-rails'
gem 'ffaker'
end
gem_group :development do
gem 'guard'
gem 'rb-inotify', require: false
exports[key] = value for key, value of {
run : run
document : document
parse : parse
resolveSource : resolveSource
version : version
defaults : defaults
languages : languages
}
@kinsteronline
kinsteronline / customer.rb
Created May 16, 2012 20:34
Authorization states in a Proc
class Customer < AR::Base
authorization_states = Proc.new do
event :start_authorizing do
transition all => :authorizing
end
event :finish_authorizing do
transition :authorizing => :authorized
end
@kinsteronline
kinsteronline / hack.sh
Created March 19, 2012 14:12 — forked from DAddYE/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@kinsteronline
kinsteronline / gist:1838254
Created February 15, 2012 19:14
monkey patched efax
module EFax
class QueryStatus
RESOURCE_NOT_FOUND = 2
end
class OutboundStatusResponse
alias_method :original_initialize, :initialize
def initialize(response)
@kinsteronline
kinsteronline / gist:1712153
Created January 31, 2012 18:47
Log Death
Started GET "/patients/324383/pharmacies/search?search%5Bnew_pharmacy%5D=true&search%5Bpatient_id%5D=324383&search%5Bprescription_id%5D=20902571" for 173.24.225.166 at 2012-01-31 18:45:31 +0000
Processing by PharmaciesController#search as */*
Parameters: {"search"=>{"new_pharmacy"=>"true", "patient_id"=>"324383", "prescription_id"=>"20902571"}, "patient_id"=>"324383"}
User Load (0.8ms) SELECT "users".* FROM "users" WHERE "users"."id" = 422 LIMIT 1
CACHE (0.0ms) SELECT "users".* FROM "users" WHERE "users"."id" = 422 LIMIT 1
(0.3ms) BEGIN
(0.5ms) UPDATE "users" SET "last_request_at" = '2012-01-31 18:45:31.894869', "perishable_token" = '7KVh2qvR9hLREHoss8ei', "updated_at" = '2012-01-31 18:45:31.896128' WHERE "users"."id" = 422
(2.8ms) COMMIT
Pharmacy Load (1.9ms) SELECT "pharmacies".* FROM "pharmacies" INNER JOIN "prescriptions" ON "prescriptions"."pharmacy_id" = "pharmacies"."id" INNER JOIN "medications" ON "medications"."id" = "prescriptions"."medication_id" INNER JOIN "patients" ON "p
@kinsteronline
kinsteronline / rails31init.md
Created December 29, 2011 14:16 — forked from dallas/rails31init.md
Rails 3.1 with Rspec, Factory Girl, Haml, Simple Form, Database Cleaner, Spork, and Guard

Install Rails 3.1

gem install rails

generate new app, skipping Test::Unit file generation

rails new my_app -T

Set up Gemfile