Skip to content

Instantly share code, notes, and snippets.

View nubbel's full-sized avatar

Dominique d'Argent nubbel

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')
@aishfenton
aishfenton / serializer_benchmarks.rb
Created July 18, 2010 02:32 — forked from visfleet/performance_of_yaml_vs_marshal.rb
Performance comparison of different ruby serializer methods
# sudo gem install bson
# sudo gem install bson_ext
# sudo gem install yajl-ruby
# sudo gem install json
# sudo gem install msgpack
require 'rubygems'
require 'benchmark'
require 'yaml'
require 'bson'
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>DVTConsoleDebuggerInputTextColor</key>
<string>0.052 0.489 0.482 1</string>
<key>DVTConsoleDebuggerInputTextFont</key>
<string>Menlo-Bold - 11.0</string>
<key>DVTConsoleDebuggerOutputTextColor</key>
<string>0.432 0.325 0.276 1</string>
@JensAyton
JensAyton / gist:548432
Created August 24, 2010 22:11
Sketch for multiple return values in Objective-C
// Sketch for multiple return values in Objective-C
// Method declaration:
- (id, NSError *) someMethod:param;
// Desugars to:
typedef struct { id a, NSError *b } __someMethodResult; // Obviously gensym/anonymous in real implementation
- (__someMethodResult) someMethod:param;
// Return type encoding would be "{?=@@}", anonymous struct of two objects.
@0xced
0xced / UIDevice+serialNumber.h
Last active February 7, 2024 06:14
UIDevice+serialNumber
/*
* Adds the serialNumber property to the UIDevice class
*
* The implementation uses undocumented (for iOS) IOKit functions,
* so handle with caution and be prepared for nil.
*/
#import <UIKit/UIDevice.h>
@interface UIDevice (serialNumber)
@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")
@thinkerbot
thinkerbot / gem_env.sh
Created November 8, 2010 18:28
Illustrates GEM_HOME vs GEM_PATH
# Two ENV variables control the 'gem' command:
#
# GEM_HOME: the single path to a gem dir where gems are installed
# GEM_PATH: a standard PATH to gem dirs where gems are found
#
# A gem directory is a directory that holds gems. The 'gem' command will lay
# out and utilize the following structure:
#
# bin # installed bin scripts
# cache # .gem files ex: cache/gem_name.gem
@jessearmand
jessearmand / mpParse.m
Created November 23, 2010 13:59
A command line tool to parse .mobileprovision file
//
// © 2008 Eugene Solodovnykov
// http://idevblog.info/mobileprovision-files-structure-and-reading/
//
#import <Foundation/Foundation.h>
int main (int argc, const char * argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
@sumskyi
sumskyi / README.md
Last active June 7, 2022 18:49
rails STI with custom "type" field and storing there value different from ClassName

GeoEntity.last

SELECT geo_entities.* FROM geo_entities ORDER BY geo_entities.id DESC LIMIT 1

returns:

County id: 4, eid: nil, pid: nil, ename: nil, etype: 2, created_at: "2011-11-21 06:26:37", updated_at: "2011-11-21 06:26:37"

@dcernst
dcernst / HWTemplate.tex
Last active April 23, 2024 05:19
LaTeX homework template for Weekly Homework assignments for Dana Ernst's courses.
% --------------------------------------------------------------
% This is all preamble stuff that you don't have to worry about.
% Head down to where it says "Start here"
% --------------------------------------------------------------
\documentclass[12pt]{article}
\usepackage[margin=1in]{geometry}
\usepackage{amsmath,amsthm,amssymb}