Skip to content

Instantly share code, notes, and snippets.

jspillers / index.html
Last active June 5, 2020 05:40
View index.html
<!DOCTYPE html>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
<link rel='stylesheet' href="">
<link rel="stylesheet" href="">
<script src=""></script>
<script src=""></script>
jspillers / Deformer.cs
Created April 12, 2017 14:00
one method from a c# class
View Deformer.cs
private void FlattenVolume() {
float flattenToY = Mathf.Lerp(deformerCollider.bounds.min.y, deformerCollider.bounds.max.y, flattenTo);
float flattenHeight = Coord.WorldHeightToTerrainHeight(flattenToY, terrain);
foreach (Vertex v in this.localHeightMap.localHeightmapVertices) {
if (v.insideDeformerCollider || (!v.insideDeformerCollider && this.flattenArea)) {
if (v.areaZ < this.terrainArea.terrainHeights.GetLength(0) || v.areaX < this.terrainArea.terrainHeights.GetLength(1)) {
this.terrainArea.terrainHeights[v.areaZ, v.areaX] = flattenHeight;
jspillers /
Created June 12, 2015 17:17
gtk3 error when requiring gem
➜ ruby gtk3_test.rb
/Users/jarrod/.rbenv/versions/2.2.2/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require': dlopen(/Users/jarrod/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-13/2.2.0-static/glib2-2.2.5/glib2.bundle, 9): Library not loaded: @@HOMEBREW_PREFIX@@/opt/gettext/lib/libintl.8.dylib (LoadError)
Referenced from: /Users/jarrod/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-13/2.2.0-static/glib2-2.2.5/glib2.bundle
Reason: image not found - /Users/jarrod/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-13/2.2.0-static/glib2-2.2.5/glib2.bundle
from /Users/jarrod/.rbenv/versions/2.2.2/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/jarrod/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/glib2-2.2.5/lib/glib2.rb:105:in `rescue in <top (required)>'
from /Users/jarrod/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/glib2-2.2.5/lib/glib2.rb:101:in `<top (required)>'
from /Users/jarrod/.rbenv/version
jspillers / vcr_webmock_and_live_http_simultaneously.rb
Created June 9, 2015 20:13
Sandbox test to get VCR, WebMock, and "real" http all working side by side in the same spec suite
View vcr_webmock_and_live_http_simultaneously.rb
require 'rubygems'
require 'rspec'
require 'webmock'
require 'vcr'
require 'pry'
# in a Rails app, this would be in an initializer
allow_localhost: true,
net_http_connect_on_start: true
View gist:2346471
>> hsh = { :foo => ->(x){ {x: x } }}
=> {:foo=>#<Proc:0x007ff2c20320c0@(irb):9 (lambda)>}
>> hsh[:foo]
=> #<Proc:0x007ff2c20320c0@(irb):9 (lambda)>
>> hsh[:foo].call('qwerasdf')
=> {:x=>"qwerasdf"}
View gist:1706581
require 'rest_client'
def import(service_url, uri, data)
content_type: :json,
accept: :json
jspillers / run_spec_multiple.rb
Created January 19, 2012 16:48
run specs multiple times with truncated output
View run_spec_multiple.rb
#!/usr/bin/env ruby
ARGV[0].to_i.times do |i|
puts "run #{i+1}"
result = `rake SPEC=#{ARGV[1]}`
puts result.match(/(Finished in \d+.\d+ seconds)/)[1]
puts result.match(/(\d+ examples, \d+ failures?)/)[1]
if result.match(/Failed examples:/)
puts ''
puts 'Failed examples:'
jspillers /
Created December 2, 2011 00:17 — forked from jumski/
BackboneJS sync hack to namespace params when saving/updating model
* add property that will be used as a namespace in the json request
* put this code before your Backbone app code
* use toJSON() as usual (so there is no namespacing in your templates)
* your model's data will be sent under key when calling save()
# save reference to Backbone.sync
Backbone.oldSync = Backbone.sync
jspillers / backbone.rails.js
Created December 1, 2011 23:52 — forked from tmarek/backbone.rails.js
Makes Backbone.js play nicely with default Rails setup
View backbone.rails.js
// Backbone.Rails.js
// Makes Backbone.js play nicely with the default Rails setup, i.e.,
// no need to set
// ActiveRecord::Base.include_root_in_json = false
// and build all of your models directly from `params` rather than
// `params[:model]`.
// Load this file after backbone.js and before your application JS.