This file contains hidden or 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
| # encoding: UTF-8 | |
| require 'rubygems' | |
| require 'set' | |
| require 'uri' | |
| require 'yajl' | |
| require 'yajl/http_stream' | |
| ##################################### | |
| # TwitterFeed | |
| # represents the twitter feed / stream |
This file contains hidden or 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
| class Player | |
| def play_turn(warrior) | |
| # cool code goes here | |
| warrior.walk! | |
| end | |
| end | |
| class Player | |
| def play_turn(warrior) | |
| # cool code goes here |
This file contains hidden or 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 'debugger' | |
| require 'awesome_print' | |
| # project euler problem 67 depends on problem 18 | |
| # maximum path sum | |
| # use a bottom up strategy | |
| # split into subproblems | |
| # store subproblem result | |
| # don't recompute subproblem |
This file contains hidden or 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
| river = “************~~~” | |
| river1 = “****~~~~” | |
| river2 = “****************~~*~~~*” | |
| # NOTES: | |
| # | |
| # acc. by 1 | |
| # stay the same speed |
This file contains hidden or 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
| def multiples(max) | |
| (1...max).select {|i| i % 3 == 0 || i % 5 == 0 }.reduce(:+) | |
| end | |
| puts multiples(1000) |
This file contains hidden or 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
| input = [ | |
| { time: 201_201, x: 2 }, | |
| { time: 201_201, y: 7 }, | |
| { time: 201_201, z: 2 }, | |
| { time: 201_202, a: 3 }, | |
| { time: 201_202, b: 4 }, | |
| { time: 201_202, c: 0 } | |
| ] | |
| output = [ |
This file contains hidden or 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
| export GOPATH=$HOME/go | |
| export PATH=$PATH:$GOPATH/bin | |
| brew update | |
| brew install go | |
| brew install git | |
| brew install mercurial | |
| mkdir $HOME/go | |
| mkdir -p $GOPATH/src/github.com/user |
This file contains hidden or 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
| SSID BSSID RSSI CHANNEL HT CC SECURITY (auth/unicast/group) | |
| DIRECT-roku-138 b0:a7:37:0b:17:2b -45 11 Y US WPA2(PSK/AES/AES) | |
| DIRECT-roku-696 b0:a7:37:0e:3c:c3 -48 11 Y US WPA2(PSK/AES/AES) | |
| VCHO0 00:26:b8:11:6d:e4 -70 6 Y US WEP | |
| SBG65803E 20:10:7a:7f:59:55 -81 1 Y -- WPA(PSK/AES/AES) WPA2(PSK/AES/AES) |
This file contains hidden or 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
| #!/usr/bin/env ruby | |
| def max_path_sum(file) | |
| input = File.open(file).readlines | |
| numbers = input.collect { |line| line.split(" ").map(&:to_i) } | |
| # started from the bottom | |
| triangle_size = numbers.size - 2 |
This file contains hidden or 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
| class Array | |
| def flatflat | |
| result = [] | |
| self.each do |elem| | |
| if elem.is_a?(Array) | |
| result.concat(elem.flatflat) | |
| else | |
| result.push(elem) | |
| end | |
| end |
OlderNewer