Skip to content

Instantly share code, notes, and snippets.

@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')
@kinopyo
kinopyo / omniauth_macros.rb
Created November 4, 2011 05:44
Integration test with Omniauth. This example is using twitter, and assume you've installed rspec and capybara. Official document is here: https://github.com/intridea/omniauth/wiki/Integration-Testing
# in spec/support/omniauth_macros.rb
module OmniauthMacros
def mock_auth_hash
# The mock_auth configuration allows you to set per-provider (or default)
# authentication hashes to return during integration testing.
OmniAuth.config.mock_auth[:twitter] = {
'provider' => 'twitter',
'uid' => '123545',
'user_info' => {
'name' => 'mockuser',
@jimbojsb
jimbojsb / gist:1630790
Created January 18, 2012 03:52
Code highlighting for Keynote presentations

Step 0:

Get Homebrew installed on your mac if you don't already have it

Step 1:

Install highlight. "brew install highlight". (This brings down Lua and Boost as well)

Step 2:

@gburd
gburd / Makefile.patch
Created September 26, 2012 16:26
Building the xv6 operating system using Clang on OS/X (10.8) for fun and non-profit.
diff --git a/Makefile b/Makefile
index 33bfb0a..af625c8 100644
--- a/Makefile
+++ b/Makefile
@@ -29,10 +29,10 @@ OBJS = \
vm.o\
# Cross-compiling (e.g., on Mac OS X)
-#TOOLPREFIX = i386-jos-elf-
+TOOLPREFIX = /opt/gnu/bin/i386-jos-elf-
@mackermedia
mackermedia / Gemfile
Last active August 4, 2016 19:07
Capybara + JS Testing
group :test do
gem 'capybara'
gem 'poltergeist' # gem 'capybara-webkit'
gem 'database_cleaner'
end
@ricardozea
ricardozea / ie67891011-css-hacks.txt
Last active February 2, 2023 15:17
IE CSS hacks - IE6, 7, 8, 9, 10, 11
IE6 Only
==================
_selector {...}
IE6 & IE7
==================
*html or { _property: }
IE7 Only
==================
@jed
jed / how-to-set-up-stress-free-ssl-on-os-x.md
Last active August 30, 2024 08:37
How to set up stress-free SSL on an OS X development machine

How to set up stress-free SSL on an OS X development machine

One of the best ways to reduce complexity (read: stress) in web development is to minimize the differences between your development and production environments. After being frustrated by attempts to unify the approach to SSL on my local machine and in production, I searched for a workflow that would make the protocol invisible to me between all environments.

Most workflows make the following compromises:

  • Use HTTPS in production but HTTP locally. This is annoying because it makes the environments inconsistent, and the protocol choices leak up into the stack. For example, your web application needs to understand the underlying protocol when using the secure flag for cookies. If you don't get this right, your HTTP development server won't be able to read the cookies it writes, or worse, your HTTPS production server could pass sensitive cookies over an insecure connection.

  • Use production SSL certificates locally. This is annoying

@domenic
domenic / InstrumentedPromise.js
Last active August 7, 2017 16:38
Promise subclass
class InstrumentedPromise extends Promise {
constructor(...args) {
super(...args);
console.log("constructed");
}
then(...args) {
console.log("then'd");
return this.constructor.cast(super(...args));
}
@FiloSottile
FiloSottile / 32.asm
Last active November 7, 2024 06:51
NASM Hello World for x86 and x86_64 Intel Mac OS X (get yourself an updated nasm with brew)
; /usr/local/bin/nasm -f macho 32.asm && ld -macosx_version_min 10.7.0 -o 32 32.o && ./32
global start
section .text
start:
push dword msg.len
push dword msg
push dword 1
mov eax, 4
@elizaaverywilson
elizaaverywilson / NSLog Token Cheat Sheet
Created November 23, 2013 19:27
NSLog Token Cheat Sheet
// NSLog Tokens
// ----------------------------------------------------
// Symbol .........|...Displays
// %@ .............|...id
// %d,%D,%i .......|...long
// %u,%U ..........|...unsigned long
// %hi ............|...short
// %hu ............|...unsigned short
// %qi ............|...long long
// %qu ............|...unsigned long long