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), |
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
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
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
[~/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
[~/sendgrid-example] heroku run rake db:migrate | |
Running rake db:migrate attached to terminal... up, run.11 | |
rake aborted! | |
undefined method `task' for #<SendgridExample::Application:0x000000034ab980> | |
(See full trace by running task with --trace) |
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
Lbl G | |
ClrHome | |
Disp " J.M.'S DRUGWAR"," SIMULATION",""," VERSION 2.00",""," JUST SAY NO." | |
2000→Z | |
5000→Y | |
0→V | |
100→K | |
1→B | |
2→N | |
0→I |
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
Should see something like this: | |
>> Rails.cache | |
=> #<ActiveSupport::Cache::DalliStore:0x7f43ecf2e900 @data=#<Dalli::Client:0x7f43ece7be90 @ring=nil, @options={:expires_in=>0}, @servers=["mc5.ec2.northscale.net"]>, @middleware=ActiveSupport::Cache::Strategy::LocalCache, @thread_local_key=:active_support_cache_dalli_store_local_cache_69964857439360, @options={}> | |
Seeing this: | |
>> Rails.cache | |
=> <#ActiveSupport::Cache::MemoryStore entries=2, size=8, options={}> |
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
-----> Heroku receiving push | |
-----> Ruby/Rails app detected | |
-----> Detected Rails is not set to serve static_assets | |
Installing rails3_serve_static_assets... done | |
-----> Configure Rails 3 to disable x-sendfile | |
Installing rails3_disable_x_sendfile... done | |
-----> Configure Rails to log to stdout | |
Installing rails_log_stdout... done | |
-----> Gemfile detected, running Bundler version 1.0.7 | |
Unresolved dependencies detected; Installing... |
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
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA0L8ZLq6XbWgDJFTk5RE+hvGKCPHk7OuAME666HgeoG1uBYpUOu9W9OTOoUpSVA1fEsT9v1Q5y39gPoExGknqLEKm7DWQ8j8gITLI9u/pN5W6Mk8n9WzSbn0e9iymjdO7SyUH5y2V+vWjlAeb9RfSY+cpcVpfdVdQ+SaoOGRtr90pGO6Lgun5z2Kh+bgN2D0flQ4uVF+akG2FRZjUL74Slmdgqnji6SODBXemyAsKLx2dLkYVuVHmDYIkFoqDEqxQQ0H0d7oVYp82tsQgm/Q0znVAnZ/Kw18POuUu5hdbsQ5OVA+mhf8KoylAD6Doe2BDi39vJqOZ3U20q0OV2/a6cQ== [email protected] |
OlderNewer