Skip to content

Instantly share code, notes, and snippets.

View ikennaokpala's full-sized avatar
🎯
Focusing

Ikenna N. Okpala ikennaokpala

🎯
Focusing
View GitHub Profile
VCR.use_cassette(postcode_found, :record => :new_episodes) do
response = Net::HTTP.get_response('mapit.com', '/postcode')
puts "Response: #{response.body}"
end
require 'vcr'
VCR.configure do |config|
config.default_cassette_options = {:record => :new_episodes, :serialize_with => :json}
config.cassette_library_dir = 'spec/fixtures/cassettes'
config.hook_into :webmock
config.ignore_hosts '127.0.0.1' # allow selenium/capybara to do its thing
end
group :test do
gem 'webmock', '= 1.15.2'
gem 'vcr'
end
require "spec_helper"
describe ExampleController do
context "GET #index" do
let(:resources) { FactoryGirl.create_list(:resource) }
before do
get :index
end

Capybara

save_and_open_page

Matchers

have_button(locator)

Twitter autoresponder bot

By Daniel15 (dan.cx) This is a very simple Twitter autoresponder bot. It requires PECL OAuth extension to be installed (run "pecl install oauth", or if on Windows, grab php-oauth.dll. If using cPanel you can install it via WHM). The authentication is designed for command-line usage, it won't work too well via a web browser. You'll have to sign up for an application on Twitter's site to get the consumer key and secret.

Could be modified to be more advanced (match regular expressions to answer questions, etc.)

Questions? See my blog post - http://dan.cx/blog/2011/06/twitter-autoreply-bot-dbznappa

Modified 2013-06-13 - Twitter API 1.0 discontinued, modified to use Twitter API 1.1

Twitter autoresponder bot

By Daniel15 (dan.cx) This is a very simple Twitter autoresponder bot. It requires PECL OAuth extension to be installed (run "pecl install oauth", or if on Windows, grab php-oauth.dll. If using cPanel you can install it via WHM). The authentication is designed for command-line usage, it won't work too well via a web browser. You'll have to sign up for an application on Twitter's site to get the consumer key and secret.

Could be modified to be more advanced (match regular expressions to answer questions, etc.)

Questions? See my blog post - http://dan.cx/blog/2011/06/twitter-autoreply-bot-dbznappa

Modified 2013-06-13 - Twitter API 1.0 discontinued, modified to use Twitter API 1.1

// Traverses an arbitrary struct and translates all stings it encounters
//
// I haven't seen an example for reflection traversing an arbitrary struct, so
// I want to share this with you. If you encounter any bugs or want to see
// another example please comment.
//
// The MIT License (MIT)
//
// Copyright (c) 2014 Heye Vöcking
//
package main
import (
"fmt"
"reflect"
)
//function types
type mapf func(interface{}) interface{}
brew install homebrew/dupes/apple-gcc42
rbenv install 1.9.3-p484
rbenv global 1.9.3-p484
git clone https://github.com/cowboyd/libv8.git
cd libv8
git checkout 3.11
export CC=/usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/gcc-4.2
export CXX=/usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/g++-4.2
export CPP=/usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/cpp-4.2
bundle exec rake clean build binary