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
I'd start fresh with rvm: | |
sudo rvm implode | |
\curl -L https://get.rvm.io | bash -s stable | |
Make sure homebrew is installed: | |
ruby -e "$(curl -fsSkL raw.github.com/mxcl/homebrew/go)" | |
Install libyaml, universally |
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 'em-synchrony' | |
require 'em-synchrony/em-http' | |
require 'em-synchrony/iterator' | |
require 'typhoeus' | |
require 'benchmark' | |
(1..5000).each do urls << "http://example.com" end | |
puts "EM::Synchrony:\n\n" |
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 'capybara' | |
require 'capybara/poltergeist' | |
# Capybara configuration | |
Capybara.run_server = false | |
Capybara.javascript_driver = :poltergeist | |
Capybara.default_wait_time = 10 | |
Capybara.register_driver :poltergeist do |app| | |
Capybara::Poltergeist::Driver.new(app, { :phantomjs_options => ['--ignore-ssl-errors=yes'] }) |
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
# step_definitions | |
filepath = File.dirname(__FILE__) + "/../../templates/" | |
Rabl.render(false, "test.json", :view_path => filepath, :format => :json) | |
# test.json.rabl | |
object false | |
node(:RequestId) { "<cool>" } |
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
# To use this you will need: | |
# lazy_high_charts gem (I used version 1.4.3) - https://github.com/michelson/lazy_high_charts | |
# phantomJS installed on your machine - http://phantomjs.org/ | |
# Responsible for convertion LazyHighChart object into image | |
# Receives LazyHighChart Object | |
def render_chart(high_chart, image_format="png", options = {}) | |
options = options.select {|key, value| RENDER_OPTIONS.include?(key.to_s) } | |
begin | |
# First we will create file that contains json properties from our chart |
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
(function(global) { | |
var silpUrl = '//s3-eu-west-1.amazonaws.com/silp.shootitlive.com/js/silp.min.js'; | |
// Globals | |
if(!global.Silp) { global.Silp = {}; }; | |
var Silp = global.Silp; | |
// To keep track of which embeds we have already processed | |
if(!Silp.foundEls) Silp.foundEls = []; |
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 'stringio' | |
require 'timeout' | |
class Object | |
def methods_returning(expected, *args, &blk) | |
old_stdout = $> | |
$> = StringIO.new | |
methods.select do |meth| | |
Timeout::timeout(1) { dup.public_send(meth, *args, &blk) == expected rescue false } rescue false |
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
package main | |
import garyredis "github.com/garyburd/redigo/redis" | |
import "fmt" | |
var pool garyredis.Pool | |
func PooledGet(key string) (string, error) { | |
conn := pool.Get() |
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 API::V1::BaseController < ApplicationController | |
skip_before_filter :verify_authenticity_token | |
before_filter :cors_preflight_check | |
after_filter :cors_set_access_control_headers | |
def cors_set_access_control_headers | |
headers['Access-Control-Allow-Origin'] = '*' | |
headers['Access-Control-Allow-Methods'] = 'POST, GET, PUT, DELETE, OPTIONS' |
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 bash | |
wget=/usr/bin/wget | |
for i in `seq 9000 12000` | |
do | |
echo "$i" | |
cool="https://results.chronotrack.com/event/results/event/event-$i" | |
wget -qO- $cool | perl -l -0777 -ne 'print $1 if /<title.*?>\s*(.*?)\s*<\/title/si' | |
done |
OlderNewer