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 'uri' | |
#require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "paths")) | |
module WithinHelpers | |
def with_scope(locator) | |
locator ? within(locator) { yield } : yield | |
end | |
end | |
World(WithinHelpers) |
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 'uri' | |
#require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "paths")) | |
module WithinHelpers | |
def with_scope(locator) | |
locator ? within(locator) { yield } : yield | |
end | |
end | |
World(WithinHelpers) |
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
- (NSString *)generatePDFFromWebView | |
{ | |
NSFileManager *fileManager = [NSFileManager defaultManager]; | |
NSString *pdfPath = [fileManager applicationSupportDirectory]; | |
pdfPath = [pdfPath stringByAppendingPathComponent:@"exportedData.pdf"]; | |
self.PDFCreator = [NDHTMLtoPDF createPDFWithURL:[NSURL URLWithString:@"www.cnn.com"] | |
pathForPDF:pdfPath | |
delegate:self | |
pageSize:kPaperSizeA4 |
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
#!/bin/bash | |
cd ~/code/eiacuc | |
tmux has-session -t eiacuc | |
if [ $? != 0 ] | |
then | |
tmux new -s eiacuc -n vim -d | |
tmux send-keys -t eiacuc 'vim' C-m | |
tmux split-window -v -p 20 -t eiacuc | |
tmux send-keys -t eiacuc:0.1 'cd ~/code/eiacuc' C-m | |
tmux new-window -n server -t eiacuc |
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 "peach" | |
mutex = Mutex.new | |
t=(1..500000).map{ rand}; | |
a=0; | |
t2=t.pmap(4) do |z| | |
mutex.lock | |
a+=1; | |
mutex.unlock |
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
root@beaglebone:~/code/cylon# node main.js | |
I, [2014-10-10T07:01:35.775Z] INFO -- : Initializing connections. | |
I, [2014-10-10T07:01:35.798Z] INFO -- : Initializing connection 'joystick'. | |
D, [2014-10-10T07:01:35.805Z] DEBUG -- : Loading adaptor 'joystick'. | |
Error: libSDL2-2.0.so.0: cannot open shared object file: No such file or directory | |
at Module.load (module.js:356:32) | |
at Function.Module._load (module.js:312:12) | |
at Module.require (module.js:364:17) | |
at require (module.js:380:17) |
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 'sinatra' | |
enable :sessions | |
$foo = ['foo', 'bar'] | |
$foo.each do |vi| | |
get '/' + vi do | |
erb :hello | |
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
require 'artoo' | |
#connection :loop | |
#device :passthru | |
connection :sphero, :adaptor => :sphero, :port => '/dev/tty.Sphero-YBB-AMP-SPP' | |
device :sphero, :driver => :sphero | |
api :host => '127.0.0.1', :port => '4321' |
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 'artoo' | |
connection :sphero, :adaptor => :sphero, :port => '/dev/tty.Sphero-YBB-AMP-SPP' | |
device :sphero, :driver => :sphero | |
connection :keyboard, adaptor: :keyboard | |
device :keyboard, driver: :keyboard, connection: :keyboard | |
def keypress(sender, key) | |
case key |
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
def wait_for_ajax | |
max_ajax_wait = 60 | |
time_limit, interval = (Time.now + max_ajax_wait), 0.5 | |
loop do | |
break if page.evaluate_script("(typeof(jQuery) !== 'undefined' && jQuery.active === 0)") | |
sleep interval | |
fail "Wait for AJAX timed out after waiting for #{max_ajax_wait} seconds" if Time.now > time_limit | |
end | |
end |
OlderNewer