Skip to content

Instantly share code, notes, and snippets.

View raws's full-sized avatar
🥯
dabbling in pumpernickel

Ross Paffett raws

🥯
dabbling in pumpernickel
View GitHub Profile
#!/bin/bash
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java -jar /Applications/TechnicLauncher.jar
@raws
raws / foos_controller.rb
Created March 8, 2013 00:45
I don’t like this pattern
FoosController < ApplicationController
def create
if @foo.save
render :create_success # => app/views/foos/create_success.coffee
else
render :create_error # => app/views/foos/create_error.coffee
end
end
end
@raws
raws / gist:5079375
Created March 4, 2013 01:53
Minecraft mod directory listing
$ ls -lR minecraft-mods
total 0
drwxr-xr-x 36 ross staff 1.2K Jul 30 2012 1.2.5/
drwxr-xr-x 8 ross staff 272B Jan 27 00:26 1.4.7/
minecraft-mods/1.2.5:
total 46136
-rw-r--r-- 1 ross staff 824K May 3 2012 BetterThanWolves-3.6.0.zip
-rw-r--r--@ 1 ross staff 84K May 2 2012 CameraStudioV1.2.4b347.zip
-rw-r--r--@ 1 ross staff 261K May 2 2012 Daxnitro's Shader Core M [1.2.5].zip
@raws
raws / fixture_helpers.rb
Created February 23, 2013 15:48
Recursive file system stubs for fakefs
require 'fileutils'
require 'yaml'
module Tower
module FixtureHelpers
def self.fixture(fixture_name)
fixtures[fixture_name] || fixture_not_found!(fixture_name)
end
def self.fixture_not_found!(fixture_name)
@raws
raws / gist:4719762
Created February 6, 2013 02:37
Precompiled static error pages written in Haml using Rails 3's asset pipeline
Rails.application.assets.register_engine '.haml', Tilt::HamlTemplate
config.assets.register_mime_type 'text/html', '.html'
config.assets.paths << Rails.root.join('app', 'views', 'errors')
config.assets.precompile += %w(404.html 500.html)
config.exceptions_app = ActionDispatch::PublicExceptions.new(Rails.root.join('public', 'assets'))
@raws
raws / injected.html
Last active December 11, 2015 21:18
Squarespace injection
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
<script type="text/javascript" charset="utf-8">
$(function() {
var path = window.location.pathname.toString();
var patterns = {
"about": /about$/i,
"contact": /contact$/i
};
for (colorBarClass in patterns) {
@raws
raws / slugs.rb
Created December 25, 2012 01:53 — forked from bkerley/slugs.rb
> ruby slugs.rb
id: 1639513188
enciphered output, string-escaped for your convenience:
"X\xD0\x97N"
slug: lt1krc
decrypted id: 1639513188
the same?
true
@raws
raws / bijective.rb
Created December 25, 2012 00:58 — forked from zumbojo/bijective.rb
# Simple bijective function
# Basically encodes any integer into a base(n) string,
# where n is ALPHABET.length.
# Based on pseudocode from http://stackoverflow.com/questions/742013/how-to-code-a-url-shortener/742047#742047
ALPHABET =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".split(//)
# make your own alphabet using:
# (('a'..'z').to_a + ('A'..'Z').to_a + (0..9).to_a).shuffle.join
@raws
raws / 01-spec_helper.rb
Last active December 10, 2015 01:48
Use mongoid-rspec 1.5.5 with capybara 1.1.2 by aliasing a conflicting `have_field` rspec matcher
def fix_capybara_mongoid_matcher_conflict
Capybara::RSpecMatchers.module_eval do
alias :have_input :have_field
end
end
RSpec.configure do |config|
fix_capybara_mongoid_matcher_conflict
config.include Mongoid::Matchers
end
static {
    NoverPackage.undoPackageVersioning(MyPlugin.class);
}