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
docker run -d -p 9200:9200 \ | |
--name elasticsearch \ | |
-p 9300:9300 \ | |
-v /data:/data dockerfile/elasticsearch \ | |
/elasticsearch/bin/elasticsearch -Des.config=/data/elasticsearch.yml | |
docker run --name kibana \ | |
-d -p 8080:8080 \ | |
--link elasticsearch:docker.mrloz.xyz \ | |
clusterhq/kibana |
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
name: "Drydock" | |
steps: | |
checkout: | |
image: git-checkout | |
# Running image will bind mount /root/.ssh credentials | |
ssh: true | |
# CO -> Manual Build Script | |
manual-build: | |
dependencies: |
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
<html> | |
<head> | |
<script src="http://code.jquery.com/jquery-2.0.0.min.js"></script> | |
</head> | |
<body> | |
<div id="top"></div> | |
<div id="results"></div> | |
<script> | |
var $domElements = $("<div style='height:400px; overflow:scroll;'></div>"); | |
for(var a = 1; a <= 10; a++) { |
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
#Took me ages to work this out: | |
def setup_session(session = {}) | |
Rack::Session::Abstract::SessionHash.stub(:new).and_return(session) | |
end | |
#then in your tests | |
before :each do | |
setup_session :user_id => User.first.id | |
get '/user_required' |
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
#!/usr/bin/env ruby | |
require 'bundler' | |
require 'bundler/runtime' | |
puts 'Building gems.tags from bundle' | |
outpath = 'gems.tags' | |
begin | |
runtime = ::Bundler::Runtime.new Dir.pwd, ::Bundler.definition | |
paths = runtime.specs.map(&:full_gem_path).join(' ').strip |
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
File.open('hello.rb', 'wb') {|f| f.write 'class Hello; end' } | |
x = Module.new | |
file = File.open('hello.rb') {|f| f.read } | |
x.module_eval(file) | |
x::Hello | |
#Patch Module: | |
class Module | |
public | |
def load_from_file(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
class Object | |
def self.xtend(klass) | |
self.class.send(:include, klass) | |
end | |
end | |
module AccessorWrapper | |
def self.included(base) | |
#base.extend ClassMethods |
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 AccessorWrapper | |
def self.included(base) | |
base.extend ClassMethods | |
end | |
def self.sneaky_logger(klass, accessor) | |
@logged_stuff ||= {} | |
@logged_stuff[klass] ||= [] | |
@logged_stuff[klass] << accessor |
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 is awesome!: | |
if Date.today.wednesday? | |
else | |
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
class Object | |
def new(klass, *args) | |
klass.new(*args) | |
end | |
end | |
x = new String | |
p x | |
p new Array |
NewerOlder