This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Imagine if we had a test framework that did this :...( | |
const models = require('../models') | |
const logger = require('../logger') | |
const Promise = require('bluebird') | |
const co = require('co') | |
const isGenFn = require('is-generator').fn | |
const colors = require('colors/safe') | |
function transactionStrategy(mocha) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// These may *look* like nested conditions but they run at wildly different | |
// times during your program's execution. | |
// | |
// In the example below, t represents the time elapsed since starting the | |
// code. | |
// | |
// The user clicks the button at t = 100. | |
var condition1 = true; | |
var condition2 = true; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<body> | |
<script> | |
var hangmanStages = [ | |
` | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
# Annotates RSpec output with contact details of the person who wrote the tests that are failing. | |
# | |
# Setup: | |
# | |
# gem install colorize | |
# | |
# Usage: | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem 'rspec' | |
require 'rspec/core' | |
require 'rspec/expectations' | |
require 'rspec/autorun' | |
require 'pp' | |
RSpec.configure do |config| | |
config.color = true | |
config.formatter = 'doc' | |
config.expect_with :rspec do |c| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem 'activesupport' # {}.to_query | |
gem 'nokogiri' | |
gem 'typhoeus' | |
require 'active_support/core_ext/object' | |
require 'json' | |
require 'nokogiri' | |
require 'pp' | |
require 'typhoeus' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
gem 'activesupport' | |
require 'active_support/core_ext/string/inflections' | |
snake = ARGV.first | |
camel = snake.camelize(:lower) | |
system %{git grep -l #{snake} | xargs ruby -p -i -e '$_.gsub! /#{snake}/, "#{camel}"'} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# More useful output from Capybara. | |
# | |
# Before: | |
# | |
# Unable to find link or button "Year 5" | |
# | |
# After: | |
# | |
# Unable to find link or button "Year 5" in "Sorry, something went wrong We've | |
# been notified of the error and are looking into it." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ coffee blah.coffee | |
Error: Cannot find module 'coffee-script' | |
at Function.Module._resolveFilename (module.js:338:15) | |
at Function.Module._load (module.js:280:25) | |
at Module.require (module.js:364:17) | |
at require (module.js:380:17) | |
at Object.<anonymous> (/Users/greg/blah.coffee:1:10) | |
at Object.<anonymous> (/Users/greg/blah.coffee:1:1) | |
at Module._compile (module.js:456:26) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' rescue nil | |
gem 'activerecord', '3.2.16' | |
gem 'pg', '0.17.1' | |
require 'active_record' | |
require 'logger' | |
puts ActiveRecord::VERSION::STRING |
NewerOlder