This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[~/sendgrid-example] git push heroku master | |
Counting objects: 5, done. | |
Delta compression using up to 2 threads. | |
Compressing objects: 100% (3/3), done. | |
Writing objects: 100% (3/3), 367 bytes, done. | |
Total 3 (delta 2), reused 0 (delta 0) | |
-----> Heroku receiving push | |
-----> Rails app detected | |
-----> Installing dependencies using Bundler version 1.1.pre.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'addressable/uri' | |
def remove_query_param(url, param) | |
uri = Addressable::URI.parse(url) | |
params = uri.query_values | |
params.delete(param) | |
uri.query_values = params | |
uri.to_s | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var app = require('express').createServer(); | |
var TwitterNode = require('twitter-node').TwitterNode; | |
var sys = require('sys'); | |
var tweets = []; | |
var threshold = 10; | |
app.get('/', function(req, res){ | |
console.log('hello world') | |
res.send('hello world'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Project Euler #67 | |
t = DATA.readlines("\n").map {|x| x.split(' ').map {|i| i.to_i}} | |
# 1-liner | |
#(t.size-2).downto(0) {|ri| t[ri].each_with_index {|v,i| t[ri][i] = [v + t[ri+1][i], v + t[ri+1][i+1]].max}}; p t[0][0] | |
(t.size-2).downto(0) do |row_index| | |
t[row_index].each_with_index do |value,index| | |
t[row_index][index] = [value + t[row_index+1][index], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Project Euler #18 using recursion | |
T = DATA.readlines("\n").map {|x| x.split(' ').map {|i| i.to_i}} | |
# one-liner | |
#def max_sum(r,i) T[r+1] ? [T[r][i] + max_sum((r+1),i), T[r][i] + max_sum((r+1),(i+1))].max : T[r][i] end; puts max_sum(0,0) | |
def max_sum(row,item) | |
if T[row+1] | |
[ T[row][item] + max_sum((row+1),item), |
NewerOlder