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 'mharris_ext' | |
#CONTAINER_ID=$(docker run -d base /bin/sh -c "while true; do echo hello world; sleep 1; done") && echo $CONTAINER_ID | |
module Docker | |
class Instance | |
include FromHash | |
fattr(:commands) { [] } | |
attr_accessor :container_id |
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
unknown14109fe8fee8:docker mharris717$ git checkout -b 0.2 v0.2.0 | |
Switched to a new branch '0.2' | |
unknown14109fe8fee8:docker mharris717$ vagrant up | |
Bringing machine 'default' up with 'virtualbox' provider... | |
[default] Importing base box 'precise64'... | |
[default] Matching MAC address for NAT networking... | |
[default] Setting the name of the VM... | |
[default] Clearing any previously set forwarded ports... | |
[default] Creating shared folders metadata... |
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
ruby '1.9.3' | |
source 'https://rubygems.org' | |
gem 'rails', '3.2.13' | |
group :assets do | |
gem 'sass-rails', '~> 3.2.3' | |
gem 'coffee-rails', '~> 3.2.1' | |
gem 'uglifier', '>= 1.0.3' | |
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
MultiGen.register do |d| | |
d.project :eak do |p| | |
p.compound :model do |c| | |
c.model do |m| | |
m.file "app/models/NAME.coffee" | |
m.body "CAMEL_NAME = DS.Model.extend()\n\n`export default CAMEL_NAME`" | |
end | |
c.test do |s| | |
s.file "tests/unit/NAME_test.coffee" |
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 'json' | |
require 'open-uri' | |
url = "http://letsrevolutionizetesting.com/challenge.json" | |
loop do | |
payload = JSON.parse(open(url).read) | |
url = payload["follow"] | |
puts url | |
url = url.gsub("/challenge","/challenge.json") |
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
sample_data = [0, 1, 100, 99, 0, 10, 90, 30, 55, 33, 55, 75, 50, 51, 49, 50, 51, 49, 51] | |
def get_matching_pairs(data) | |
result_pairs = [] | |
count_hash = Hash.new { |h,k| h[k] = 0 } | |
data.each do |num| | |
count_hash[num] += 1 | |
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
# Deps for Full | |
set -e | |
echo "deb http://archive.ubuntu.com/ubuntu precise main universe" | sudo tee -a /etc/apt/sources.list | |
sudo apt-get update -y | |
# Deps for utll | |
sudo apt-get install -y libxslt-dev | |
sudo apt-get install -y libxml2-dev | |
sudo apt-get install -y libssl-dev | |
sudo apt-get install -y zlib1g-dev |
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
load "lib/baseball_lottery.rb" | |
MGC.connect! :production | |
def big_hash | |
res = {} | |
(1..100).each do |i| | |
res[i] = {} | |
50.times do | |
res[i][rand(100000000000)] = rand(1000000000000).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
library(rvest) | |
page <- html("http://www.sherdog.com/events/UFC-Fight-Night-MacDonald-vs-Saffiedine-35509") | |
rows <- page %>% | |
html_nodes("tr[itemprop=subEvent]") | |
for (row in rows) { | |
names <- row %>% | |
html_nodes("span[itemprop=name]") %>% | |
html_text() |
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
# pretending to fetch HTML | |
getBody <- function(url) { | |
if (url == "http://garbage.broken") return(0) | |
else return(paste("this is the html for ",url)) | |
} | |
sites.names <- c("Google","ESPN","Garbage","ROK") | |
sites.urls <- c("http://google.com","http://espn.com","http://garbage.broken","http://returnofkings.com") | |
sites.df <- data.frame(Name=sites.names, Url=sites.urls, stringsAsFactors=FALSE) |