Skip to content

Instantly share code, notes, and snippets.

View stevegraham's full-sized avatar
🛠️
Building @tellerhq

Stevie Graham stevegraham

🛠️
Building @tellerhq
View GitHub Profile
{
"_id": "_design/example",
"_rev": "8-9dfbf79df2f15317ef69e37e0a70a704",
"validate_doc_update": "function(newDoc,oldDoc,user) {
function require(prop, message) {
message = message || prop + 'is required'
if(!newDoc[prop]) throw({'forbidden': message })
}
require('title')
require('body')
@stevegraham
stevegraham / gist:1012070
Created June 7, 2011 11:39
culture css fixes
div#content h2 img {
float: left;
margin-right: 3px;
}
div.comment {
min-height:94px;
padding-bottom: 10px !important;
}
@stevegraham
stevegraham / fun.js
Created June 7, 2011 17:18
side-effect free js
var Enumerable = function() {
this.map = function(func, i, m) {
var idx = i || 0
var mem = m || []
if(this.length != idx) {
return this.map(func, idx+1, mem.concat(func(this[idx])))
} else {
return mem
}
}
@stevegraham
stevegraham / gist:1016806
Created June 9, 2011 14:12
pg brew recipe
If builds of PostgreSQL 9 are failing and you have version 8.x installed,
you may need to remove the previous version first. See:
https://github.com/mxcl/homebrew/issues/issue/2510
To build plpython against a specific Python, set PYTHON prior to brewing:
PYTHON=/usr/local/bin/python brew install postgresql
See:
http://www.postgresql.org/docs/9.0/static/install-procedure.html
# keith.rb
class << Time
# The only two times of the day that matter to Keith!
def now
["Bounce 'o' clock", "Tuna 'o' clock"].sample
end
end
class String
# by mark burns
brew install sl; echo "alias ls='sl'" >> ~/.bash_profile && source ~/.bash_profile
// why this?
Array.prototype.slice.call(arguments, 1)
// when you can do this?
[].slice.call(arguments, 1)
require 'net/https'
https = Net::HTTP.new('api.twilio.com', 443)
https.use_ssl = true
https.verify_mode = OpenSSL::SSL::VERIFY_PEER
https.request_get('/')
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Say>Thanks for calling</Say>
<Sms>Thanks for calling</Sms>
</Response>
# using twilio-rb
Twilio::Call.create to: telephone_number_of_participant, from: your_caller_id, url: conference_resource_url