Skip to content

Instantly share code, notes, and snippets.

View kathgironpe's full-sized avatar

Katherine Giron Pe kathgironpe

View GitHub Profile
@zhengjia
zhengjia / capybara cheat sheet
Created June 7, 2010 01:35
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Cross-browser kerning-pairs & ligatures</title>
<style>
body { font-family: sans-serif; background: #f4f3f3; color: rgba(40, 30, 0, 1); width: 500px; margin: 80px auto; padding: 0px; }
a { color: rgba(15, 10, 0, 0.8); text-decoration: none; border-bottom: 1px solid; padding: 1px 1px 0px; -webkit-transition: background 1s ease; }
a:hover { background: rgba(0, 220, 220, 0.2); }
p, li { line-height: 1.5; padding: 0em 1em 0em 0em; margin: 0em 0em 0.5em; }
$ ruby -v
ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-darwin10.4.0]
$ ruby bench_erubis_slim_haml.rb
Rehearsal ---------------------------------------------------------------------------------------
empty loop 0.000000 0.000000 0.000000 ( 0.001055)
erubis 2.690000 0.000000 2.690000 ( 2.697228)
slim 4.200000 0.010000 4.210000 ( 4.196183)
haml 3.1.0.alpha.14 (Bleeding Edge) 19.660000 0.040000 19.700000 ( 19.681350)
haml (ugly) 3.1.0.alpha.14 (Bleeding Edge) 18.940000 0.070000 19.010000 ( 19.004186)
@kathgironpe
kathgironpe / cache.rake
Created October 24, 2010 15:05
Rake task to update cached assets and upload to s3
namespace :cache do
BUCKET = 'bucketname'
desc "start aws"
task :aws do
require 'aws/s3'
AWS::S3::Base.establish_connection!(
access_key_id: 'key',
secret_access_key: 'secret'
@mnylen
mnylen / OS X Snow Leopard
Created January 5, 2011 13:21
How to get RVM + Subversion Ruby Bindings to work
$ rvm use 1.8.7-p302
$ wget http://subversion.tigris.org/downloads/subversion-1.6.15.tar.gz
$ tar -xzf subversion-1.6.15.tar.gz && cd subversion-1.6.15
$ ./configure --with-ruby-sitedir=~/.rvm/rubies/ruby-1.8.7-p302/lib/ruby --without-berkeley-db
$ make swig-rb && make install-swig-rb
To test things out:
$ irb
ruby-1.8.7-p302 > require 'svn/client'
=> true
@karmi
karmi / _readme.markdown
Created April 19, 2011 16:05
Simplistic Full-Text Search With Redis' Sorted Sets

Simplistic Full-Text Search With Redis's Sorted Sets

Howto

git clone git://gist.github.com/923934.git redisearch

cd redisearch
@dukex
dukex / jasmine.js
Created April 27, 2011 23:45
qUnit Vs Jasmine
describe("accessibility", function () {
beforeEach(function(){
var ac = $('#menu1').menu();
var item0 = $("li:eq(0) a");
});
it("should has menu class", function(){
expect(ac.hasClass("ui-menu ui-widget ui-widget-content ui-corner-all")).toEqual(true);
});
@brianstorti
brianstorti / selection_sort.rb
Created May 3, 2011 13:19
Selection Sort in ruby
# Selection sort (very slow on large lists)
a = [9,8,6,1,2,5,4,3,9,50,12,11]
n = a.size - 1
n.times do |i|
index_min = i
(i + 1).upto(n) do |j|
index_min = j if a[j] < a[index_min]
@ryanb
ryanb / README.md
Created May 15, 2011 16:24 — forked from copiousfreetime/my-gh-issues.rb
My Github Issues

First install the required gems:

gem install octokit awesomeprint rainbow

Then run it to extract all of your open GitHub issues into files (with comments).

ruby my-gh-issues.rb
@nahurst
nahurst / javascript.rb
Created May 27, 2011 00:02
Selenium, rspec, capybara integration with steak to make it like cucumber when cleaning the database javascript tests
# spec/acceptance/support/javascript.rb
RSpec.configure do |config|
config.use_transactional_fixtures = false
config.before :each do
Capybara.current_driver = :selenium if example.metadata[:js]
if Capybara.current_driver == :rack_test
DatabaseCleaner.strategy = :transaction
else
DatabaseCleaner.strategy = :truncation