Skip to content

Instantly share code, notes, and snippets.

@biscuitvile
biscuitvile / tmate.sh
Last active August 29, 2015 14:17 — forked from marcosnils/tmate.sh
#!/bin/bash
set -e
SLACK_WEBHOOK_URL=
DEFAULT_EMOJI=:slack:
CHANNEL=${1:-#general}
AUTHOR="Some user"
tmate -S /tmp/tmate.sock new-session -d && tmate -S /tmp/tmate.sock wait tmate-ready
@biscuitvile
biscuitvile / gary.log
Created February 14, 2014 14:46 — forked from NZKoz/gary.log
Koz-Prostyle-2:store michaelkoziarski$ time /usr/bin/ruby -e ''
real 0m0.117s
user 0m0.031s
sys 0m0.056s
Koz-Prostyle-2:store michaelkoziarski$ time ~/.rbenv/shims/ruby -e ''
real 0m0.096s
user 0m0.057s
sys 0m0.038s

When testing Ember code, without putting expectations in a Ember.run callback, you'll get this error:

Failure/Error: Assertion Failed: You have turned on testing mode, which disabled the run-loop's autorun. You will need to wrap any code with asynchronous side-effects in an Ember.run

The error recommends wrapping expectations in Ember.run:

describe 'something', ->
# Code:
$ -> # a.k.a. jQuery.ready ->
$("#hash-value-when-page-loaded").text(location.hash)
# Test:
location.hash = "foo"
fakeDomReady()
sinon.Container = function(namespace) {
this.namespace = namespace;
this._cache = [];
this._mocks = [];
this.container = namespace.__container__;
};
var mock = function(context, method, args) {
var object = context[method].apply(context, args);
return mockObject(context, object);
<!-- Mocha test output goes here. -->
<div id="mocha"></div>
<!-- Handlebars templates for our application. -->
<script type="text/x-handlebars">
<h1>Testing Ember.js with Mocha</h1>
{{outlet}}
</script>
<script type="text/x-handlebars" data-template-name="index">
sinon.Container = function(namespace) {
this.namespace = namespace;
this._cache = [];
this._mocks = [];
this.container = namespace.__container__;
};
var mock = function(context, method, args) {
var object = context[method].apply(context, args);
return mockObject(context, object);
@biscuitvile
biscuitvile / 1-session.sh
Created November 19, 2012 20:09 — forked from jodosha/1-session.sh
vjt's tmux RVM + ViM IDE setup
#!/bin/sh
#
# IDE Session starter - you should save this script as ~/bin/session, make it
# executable with chmod +x ~/bin/session, and then make a symlink to it for
# every application you want to start.
# E.g. ln -s session ~/bin/members creates a "members" symlink, and when you'll issue
# "members" on the command line this script will:
# Check if a tmux session named "members" exists
@biscuitvile
biscuitvile / acceptance_helper.rb
Created November 10, 2012 23:26 — forked from guilleiguaran/acceptance_helper.rb
RSpec+Capybara acceptance test example
# acceptance/acceptance_helper.rb
require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
# Put your acceptance spec helpers inside /spec/acceptance/support
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}