Skip to content

Instantly share code, notes, and snippets.

View kidbombay's full-sized avatar

Ketan Anjaria kidbombay

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')
@jittuu
jittuu / gist:792715
Created January 24, 2011 02:19
Test Omniauth Facebook Callback Controllers in Devise with rspec
require 'spec_helper'
describe Users::OauthCallbacksController, "handle facebook authentication callback" do
describe "#annonymous user" do
context "when facebook email doesn't exist in the system" do
before(:each) do
stub_env_for_omniauth
get :facebook
@mm53bar
mm53bar / deploy.rb
Created October 7, 2011 21:05
My capistrano deployment
require File.join(File.dirname(__FILE__), 'deploy/nginx')
require File.join(File.dirname(__FILE__), 'deploy/log')
default_run_options[:pty] = true
set :ssh_options, { :forward_agent => true }
set :application, "appname"
set :repository, "git@giturl"
set :scm, :git
@fern4lvarez
fern4lvarez / sudoku.rb
Created March 9, 2012 10:23
Implementation of a Sudoku solver in Ruby
#
# This module defines a Sudoku::Puzzle class to represent a 9x9
# Sudoku puzzle and also defines exception classes raised for
# invalid input and over-constrained puzzles. This module also defines
# the method Sudoku.solve to solve a puzzle. The solve method uses
# the Sudoku.scan method, which is also defined here.
#
# Use this module to solve Sudoku puzzles with code like this:
#
# require 'sudoku'
@totutote
totutote / README.md
Created April 22, 2012 14:47 — forked from wtnabe/README.md
import seed data from .csv or .yml for Rails 3.2+ Ruby 1.9.3+

Rails SeedImporter

  1. Put this code at #{Rails.root}/db/seeds.rb
  2. type rake db:setup

rake db:seed で変更のあったレコードのみ更新

Limitation

@beakr
beakr / gist:2688904
Created May 13, 2012 15:21
Custom fonts in Rubymotion
# Rakefile
Motion::Project::App.setup do |app|
# Use `rake config' to see complete project settings.
app.name = 'helloapp'
app.fonts = ['consolas.ttf']
end
# Put consolas.ttf in resources/
@aiwilliams
aiwilliams / README.md
Created May 16, 2012 13:52
Storyboard in RubyMotion 1.4

Start XCode and create a new Storyboard file. I closed all my other XCode projects. When you choose the location of the created file, it should be your RubyMotion project's resources directory. Add a UIViewController, and set it's identifier property to "Start". Add some UI elements so you can see it working.

When you run rake in your RubyMotion project, it will compile the .storyboard file. You could auto-load the Storyboard using a plist configuration, but you'll see code can do it too.

@dpsk
dpsk / deploy.rb
Created July 5, 2012 12:42 — forked from mikhailov/0. nginx_setup.sh
Nginx+Unicorn (production-ready setup)
# Capistrano configuration
#
# require 'new_relic/recipes' - Newrelic notification about deployment
# require 'capistrano/ext/multistage' - We use 2 deployment environment: staging and production.
# set :deploy_via, :remote_cache - fetch only latest changes during deployment
# set :normalize_asset_timestamps - no need to touch (date modification) every assets
# "deploy:web:disable" - traditional maintenance page (during DB migrations deployment)
# task :restart - Unicorn with preload_app should be reloaded by USR2+QUIT signals, not HUP
@seanlilmateus
seanlilmateus / gist:3187192
Last active March 5, 2021 07:17
How to use Obj-C with MacRuby/Rubymotion

Using Obj-C with MacRuby/Rubymotion

This little post aims to help you to translate Objective-C Blocks into Ruby blocks. Let's start by taking a look at few examples of iOS API call where blocks are used for animations and enumeration

Ruby Lambda Syntaxes:

Im Rubymotion and MacRuby you can use all the Ruby Lambda syntaxes that are:

block = lambda { |param|  ... }
@greypants
greypants / README.markdown
Last active October 17, 2023 05:49 — forked from reagent/nav_link.rb
RAILS 3: nav_link helper for adding 'selected' class to navigation elements