Skip to content

Instantly share code, notes, and snippets.

View mitchellh's full-sized avatar
👻
Building.

Mitchell Hashimoto mitchellh

👻
Building.
View GitHub Profile
From 4378794887eabd083daaedeac25893fc178a4bc9 Mon Sep 17 00:00:00 2001
From: Mitchell Hashimoto <mitchell.hashimoto@gmail.com>
Date: Mon, 13 Sep 2010 13:32:07 -0600
Subject: [PATCH 2/2] More modern gemspec which won't break when files are added/removed
---
sinatra.gemspec | 96 ++++++++++---------------------------------------------
1 files changed, 17 insertions(+), 79 deletions(-)
diff --git a/sinatra.gemspec b/sinatra.gemspec
From 55977ea902c27c18ee0bcca94b0cf0bb8993b02f Mon Sep 17 00:00:00 2001
From: Mitchell Hashimoto <mitchell.hashimoto@gmail.com>
Date: Wed, 15 Sep 2010 12:14:59 -0600
Subject: [PATCH] Mocha integration example for mocking and stubbing
---
examples/mocha_integration.rb | 31 +++++++++++++++++++++++++++++++
1 files changed, 31 insertions(+), 0 deletions(-)
create mode 100644 examples/mocha_integration.rb
virtualbox[master] → rake test:units
(in /Users/mitchellh/code/personal/ruby/virtualbox)
An exception occurred running /Users/mitchellh/.rvm/gems/rbx-head/gems/rake-0.8.7/lib/rake/rake_test_loader.rb
Unable to resolve type 'QueryInterface' (FFI::TypeError)
Backtrace:
FFI.find_type at kernel/platform/ffi.rb:36
FFI::Library(Class)#find_type at kernel/platform/library.rb:170
FFI::Struct.layout at kernel/platform/struct.rb:114
VirtualBox::COM::FFI::Interface.define_vtbl_for_interface at lib/virtualbox/com/ffi/interface.rb:79
module UW
# Represents a course within a curriculum at UW. An example
# of a course is "CSE 142: Introduction to Programming."
#
# ## Attributes
#
# - year
# - quarter
# - curriculum_abbreviation
# - number
virtualbox[master] → bundle console
rbx-1.8.7-p174 > VirtualBox::Lib.lib
PrimitiveFailure: get_field failed
from kernel/platform/pointer.rb:284:in `get_at_offset'
from kernel/platform/struct.rb:257:in `[]'
from /Users/mitchellh/code/personal/ruby/virtualbox/lib/virtualbox/com/ffi_interface.rb:84:in `initialize_for_version'
from /Users/mitchellh/code/personal/ruby/virtualbox/lib/virtualbox/com/ffi_interface.rb:65:in `initialize_singletons'
from kernel/bootstrap/array.rb:66:in `each'
from /Users/mitchellh/code/personal/ruby/virtualbox/lib/virtualbox/com/ffi_interface.rb:63:in `initialize_singletons'
from /Users/mitchellh/code/personal/ruby/virtualbox/lib/virtualbox/com/ffi_interface.rb:56:in `initialize_com'
#!/bin/bash
# Convenience variable to the cred path
CREDENTIALS="${AWS_PATH}/credentials/example"
# No CloudFormation (perhaps)
unset AWS_CREDENTIAL_FILE
export AWS_ACCESS_KEY_ID="foo"
export AWS_SECRET_ACCESS_KEY="bar"
/**
* Creates a build properties file resource and packages it into the JAR,
* which can be read for various information such as version and build time.
* */
trait BuildPropertiesResource extends BasicScalaProject {
/**
* Specifies the name of the resource file. This is put [by default]
* in the top level directory of the jar.
* */
def buildPropertiesResourceFile = "build.properties"
#!/usr/bin/env ruby
# This is a really stupid Ruby implementation of `cat` as
# an example of detecting '-' as stdin/stdout.
#
# Usage: rubycat.rb infile outfile
raise "Specify an input file!" if !ARGV[0]
raise "Specify an output file!" if !ARGV[1]
# This is a nginx config snippet showing how to inherit an http header
# or defaulting it to a specific value. This is useful because it allows
# upstream load balancers to set specific headers, but if they're missing
# the app LB will know how to default it.
# This will inherit the previously set X-Scheme variable, or otherwise
# default it to the current `$scheme`. Requires nginx 0.9.0+.
#
# Docs: http://wiki.nginx.org/HttpMapModule#map
map $http_x_scheme $x_scheme {
# Official base box postinstall.sh for VeeWee, used to setup lucid32
# Apt-install various things necessary for Ruby, guest additions,
# etc., and remove optional things to trim down the machine.
apt-get -y update
apt-get -y remove apparmor
apt-get -y install linux-headers-$(uname -r) build-essential
apt-get -y install zlib1g zlib1g-dev libxml2 libxml2-dev libxslt-dev libssl-dev openssl libreadline5-dev
apt-get clean