Skip to content

Instantly share code, notes, and snippets.

View haku's full-sized avatar

Fae Hutter haku

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')
@dnagir
dnagir / rspec-syntax-cheat-sheet.rb
Created November 5, 2010 09:29
RSpec 2 syntax cheat sheet by example
# RSpec 2.0 syntax Cheet Sheet by http://ApproachE.com
# defining spec within a module will automatically pick Player::MovieList as a 'subject' (see below)
module Player
describe MovieList, "with optional description" do
it "is pending example, so that you can write ones quickly"
it "is already working example that we want to suspend from failing temporarily" do
pending("working on another feature that temporarily breaks this one")
@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
@landonf
landonf / zscm.sh
Created August 19, 2011 14:49
SVN/SCM info in the ZSH prompt
#
# SCM prompt handling
#
autoload -U colors && colors
SCM_PROMPT_NEEDS_UPDATE=1
# Run before executing a command; we use this to determine whether
# we should update the prompt
function scm_prompt_preexec {
case "$(history $HISTCMD)" in
@carlhoerberg
carlhoerberg / app.rb
Created January 26, 2012 20:55
Webrick ssl example
require 'sinatra/base'
require 'openssl'
require 'webrick'
require 'webrick/https'
class App1 < Sinatra::Base
get '/' do
'app1'
end
end
@bricef
bricef / AES.c
Last active May 11, 2024 21:15
A simple example of using AES encryption in Java and C.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/*
* MCrypt API available online:
* http://linux.die.net/man/3/mcrypt
*/
#include <mcrypt.h>
@sukima
sukima / photos_tag.rb
Created May 8, 2012 01:33
Jekyll Plugin for easy FancyBox usage
# Title: Photos tag for Jekyll
# Authors: Devin Weaver
# Description: Allows photos tag to place photos as thumbnails and open in fancybox. Uses a CDN if needed.
#
# ** This only covers the markup. Not the integration of FancyBox **
#
# To see an unabridged explination on integrating this with [FancyBox][1]
# Please read my [blog post about it][2].
#
# [1]: http://fancyapps.com/fancybox/
@excalq
excalq / tmux-window-keys.sh
Created July 23, 2012 16:55
Using Back/Forward Mouse/Keyboard media keys to change Tmux/Screen Windows
# These two shortcuts allow your media keyboard or mouse's back/forward keys to change windows in screen.
# This is designed to work with tmux or screen (using ctrl+a as the command shortcut) inside a Guake terminal
# You'll also need xdotool installed (aptitude install xdotool)
# Enter these as shortcuts in Ubuntu's "System Settings" > "Keyboard" > "Shortcuts" (tab) > "Custom Shortcuts"
# Previous/Back Key
xdotool search --onlyvisible --name Guake key ctrl+a p
# Next/Forward Key
xdotool search --onlyvisible --name Guake key ctrl+a n
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@PetrGlad
PetrGlad / run-java
Created August 18, 2012 10:32
Enable java remote debugger (JDWP, openjdk)
java -agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n ClassName