Skip to content

Instantly share code, notes, and snippets.

View jejacks0n's full-sized avatar
🕴️
doing things and stuff.

Jeremy Jackson jejacks0n

🕴️
doing things and stuff.
  • Denver, CO
View GitHub Profile
@jejacks0n
jejacks0n / myworker_spec.rb
Last active August 29, 2015 14:12
Sidekiq test harness misbehaves.
require 'sidekiq/testing'
require 'sidekiq_override'
Sidekiq::Testing.inline!
class MyWorker
include Sidekiq::Worker
@executed = false
cattr_accessor :executed
def perform
self.class.executed = true
[KSPField(guiName = "Fuel crossfeed",
isPersistant = true, guiActive = true, guiActiveEditor = true)]
public bool fuelCrossFeed = false;
[KSPEvent(guiName = "Toggle crossfeed", name = "ToggleCrossFeed",
active = true, guiActive = true, guiActiveEditor = true, guiActiveUnfocused = false)]
public void ToggleCrossFeed()
{
part.fuelCrossFeed = fuelCrossFeed = !fuelCrossFeed;
}
@jejacks0n
jejacks0n / runner.js
Created January 6, 2014 17:41
js version of the phantomjs runner for teaspoon
var system, webpage,
__bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
system = require("system");
webpage = require("webpage");
this.Runner = (function() {
function Runner() {
this.waitForResults = __bind(this.waitForResults, this);
Dummy::Application.routes.draw do
sections '/cms' do
section :bar, to: 'test#welcome2'
#section :bar do
# get ":id", to: 'test#welcome'
#end
get "/welcome" => 'test#welcome', section: :foo
class @Mercury.Regions.BackgroundImage extends @Mercury.Regions.Image
@supported: document.getElementById
@supportedText: "Chrome 10+, Firefox 4+, IE 7+, Safari 5+, Opera 8+"
type = 'backgroundImage'
type: -> type
pushHistory: () ->
@history.push(src: @element.css('background-image'))
@jejacks0n
jejacks0n / config.json
Last active December 25, 2015 23:59
BitBot! Bzzzrt.
{
"Bzzzrt": {
"token": ">TOKEN_BZZZRT",
"rooms": ["Jawa Yard Sale"],
"commands": {},
"periodics": {},
"responders": {}
}
}
module JsonSpec::Matchers
def look_like(json = nil)
JsonSpec::Matchers::LookLike.new(json)
end
class LookLike < BeJsonEql
def matches?(actual_json)
raise "Expected equivalent JSON not provided" if @expected_json.nil?
@jejacks0n
jejacks0n / Gemfile
Last active December 18, 2015 12:29
Tiny Rails + Teaspoon setup (uses mocha by default). A good place to start with a small coffeescript project.
source 'https://rubygems.org'
gem 'rails'
gem 'haml-rails'
gem 'coffee-rails'
gem 'sass-rails'
# Build process dependencies
gem 'uglifier' # javascript compression
gem 'yui-compressor' # css compression
@jejacks0n
jejacks0n / gist:1630851
Created January 18, 2012 04:00
Get jasmine to tell you if a spec doesn't have any expectations
jasmine.Spec::expect = (actual) ->
@tested = true
positive = new (@getMatchersClass_())(@env, actual, this)
positive.not = new (@getMatchersClass_())(@env, actual, this, true)
return positive
jasmine.Runner::finishCallback = ->
for spec in @specs()
alert("#{spec.description} wasn't tested") unless spec.tested
@env.reporter.reportRunnerResults(@)
@jejacks0n
jejacks0n / gist:1182530
Created August 31, 2011 00:37
Evergreen nested directory support
# For evergreen nested directory support
# 1. Create a /config/evergreen.rb file and put these contents in it
module Evergreen
class Suite
def specs
Dir.glob(File.join(root, Evergreen.spec_dir, '**', '*_spec.{js,coffee,js.coffee}')).map do |path|
Spec.new(self, path.gsub(File.join(root), ''))
end
end