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
class OrbitalCoordinate | |
def initalize(lat, long, altit) | |
@lat = lat | |
@long = long | |
@altit = altit | |
# @veloc = veloc # meters per second | |
# how many seconds it will take to get to another point. | |
OrbitalVelocity..new(sec, OrbitalCoordinate) | |
end | |
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
l = [ | |
"John", | |
"John", | |
"John", | |
"John", | |
"Adam", | |
"Adam", | |
"Adam", | |
"Linda", |
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
xits = `grep -Rwn "xit |skip" spec | grep " do"`.split("\n") | |
skips = `grep -Rwn "skip " spec | grep -v ".js" | grep -v ":skip"`.split("\n") | |
blame_cmds = (xits + skips).map {|x| | |
pieces = x.split(":") | |
file = pieces[0] | |
line_num = pieces[1] | |
[x, "git blame -L#{line_num},+1 -- #{file}"] | |
} | |
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
a = "apache | |
batch_name | |
datetime_with_seconds | |
download_csv_datetime | |
download_csv_timezone | |
expiration | |
mmdd | |
mmyy | |
hhmmss | |
iso8601_milliseconds |
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
class Array | |
def square! | |
self.map! {|i| i ** 2} | |
end | |
end | |
a = [1, 2, 3] | |
a.square! | |
if a == [1, 4, 9] |
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
class OrbitalCoordinate | |
def initalize(lat, long, altit) | |
@lat = lat | |
@long = long | |
@altit = altit | |
# @veloc = veloc # meters per second | |
# how many seconds it will take to get to another point. | |
OrbitalVelocity..new(sec, OrbitalCoordinate) | |
end | |
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
irb(main):015:0> (0..4).each_with_index.map.inject(0) {|i, (j, k)| puts "i: #{i} j: #{j} k: #{k}" ; i } | |
i: 0 j: 0 k: 0 | |
i: 0 j: 1 k: 1 | |
i: 0 j: 2 k: 2 | |
i: 0 j: 3 k: 3 | |
i: 0 j: 4 k: 4 | |
=> 0 | |
irb(main):016:0> |
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
/* PayPal Shop with Apps Script */ | |
/* Written by Amit Agarwal - ctrlq.org */ | |
/* http://www.labnol.org/internet/sell-digital-products-online/28554/ */ | |
PAYPAL = [ | |
["product-001", "useful-websites-book.pdf"], | |
["product-002", "linux-training-course.mp4"], |
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
module Foo | |
def bar | |
"stuff" | |
end | |
end | |
World Foo # world-accessible | |
# pry(main)> method(:World).owner | |
# => Cucumber::RbSupport::RbDsl | |
# http://www.rubydoc.info/github/cucumber/cucumber/Cucumber/RbSupport/RbDsl: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
# Only run the following code when this file is the main file being run | |
# instead of having been required or loaded by another file | |
if __FILE__==$0 | |
# Find the parent directory of this file and add it to the front | |
# of the list of locations to look in when using require | |
$:.unshift File.expand_path("../../", __FILE__) | |
end | |
# http://stackoverflow.com/questions/4687680/what-does-if-file-0-mean-in-ruby |