Skip to content

Instantly share code, notes, and snippets.

View rafaltrojanowski's full-sized avatar
🛰️

Rafał Trojanowski rafaltrojanowski

🛰️
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')
@jraines
jraines / MacVim-Janus.md
Created May 1, 2011 20:03
Macvim & Janus

##Intro

Janus is a "basic distribution of vim plugins and tools intended to be run on top of the latest MacVIM snapshot." It is maintained by Yehuda Katz and Carl Lerche.

I recently whinged on Twitter that all I really want is vim with TextMate's Command-T go-to-file functionality and some efficient visual tab/buffer navigation. Turns out MacVim + Janus, with just a few tweaks, is all that and more.

Installing Janus

Follow the installation instructions on the git page

@jackkinsella
jackkinsella / autoclose_janus
Created September 4, 2011 18:48
How to add autoclose to Janus
#~/.janus.rake file
vim_plugin_task "autoclose", "git://github.com/Townk/vim-autoclose.git"
#~/vimrc.local file
let g:AutoClosePairs = {'(': ')', '{': '}', '[': ']', '"': '"', "'": "'", '#{': '}', '|':'|' }
let g:AutoCloseProtectedRegions = ["Character"]
ENV['RACK_ENV'] = 'test'
require 'bundler/setup'
require 'test/unit'
gem 'minitest'
require 'timecop'
require 'grape'
require 'logger'
Grape::API.logger = Logger.new('/dev/null')
@nazgob
nazgob / ctags.setup
Created January 6, 2012 13:44
ctags setup on mac
# you have ctags but it does not work...
$ ctags -R --exclude=.git --exclude=log *
ctags: illegal option -- R
usage: ctags [-BFadtuwvx] [-f tagsfile] file ...
#you need to get new ctags, i recommend homebrew but anything will work
$ brew install ctags
#alias ctags if you used homebrew
$ alias ctags="`brew --prefix`/bin/ctags"
@schneems
schneems / user_helper.rb
Created January 16, 2012 13:51
Devise Stub logged in user
include Devise::TestHelpers
# gives us the login_as(@user) method when request object is not present
include Warden::Test::Helpers
Warden.test_mode!
# Will run the given code as the user passed in
def as_user(user=nil, &block)
current_user = user || Factory.create(:user)
if request.present?
@krsmurata
krsmurata / clear_logs.rb
Created February 15, 2012 14:36
Clear development logs
if Rails.env.development?
MAX_LOG_SIZE = 10.megabytes
logs = [ File.join(Rails.root, 'log', 'development.log'), File.join(Rails.root, 'log', 'test.log') ]
logs.each do |log|
log_size = File.size?(log).to_i
if log_size > MAX_LOG_SIZE
$stdout.puts "Removing Log: #{log}"
`rm #{log}`
@gcatlin
gcatlin / gist:1847248
Created February 16, 2012 19:43
Install specific version of Homebrew formula
brew update
brew versions FORMULA
cd `brew --prefix`
git checkout HASH Library/Formula/FORMULA.rb # use output of "brew versions"
brew install FORMULA
brew switch FORMULA VERSION
git checkout -- Library/Formula/FORMULA.rb # reset formula
## Example: Using Subversion 1.6.17
#
@tomtung
tomtung / saas-class-homework-ruby-basics.rb
Created March 4, 2012 15:30
SaaS Class Homework: Ruby Basics
# Homework 1 - Part 1
def palindrome?(string)
string = string.downcase.gsub(/\W/, '')
string == string.reverse
end
def count_words(string)
Hash[
string.downcase.scan(/\w+/).
group_by{|s| s}.
@erikh
erikh / hack.sh
Created March 31, 2012 07:02 — forked from DAddYE/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#