Skip to content

Instantly share code, notes, and snippets.

@wallace
wallace / 0_reuse_code.js
Created September 28, 2015 15:09
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@wallace
wallace / gist:6127633
Last active December 20, 2015 11:59 — forked from jeremiaheb/gist:6124581
class StationLog < ActiveRecord::Base
belongs_to :boat_log
has_many :rep_logs, :dependent => :destroy
accepts_nested_attributes_for :rep_logs, :reject_if => lambda { |a| a[:replicate].blank? }, :allow_destroy => true
EARTH_RADIUS = 6371000 # Earth's radius in meters
# convert degrees to radians
def self.convDegRad(value)
@wallace
wallace / getting_barred.rb
Created April 27, 2012 17:01 — forked from randym/getting_barred.rb
Axlxs: Writing Excel With Ruby - Conditional Formatting
require 'axlsx'
p = Axlsx::Package.new
p.workbook do |wb|
# define your regular styles
styles = wb.styles
title = styles.add_style :sz => 15, :b => true, :u => true
default = styles.add_style :border => Axlsx::STYLE_THIN_BORDER
header = styles.add_style :bg_color => '00', :fg_color => 'FF', :b => true
money = styles.add_style :format_code => '#,###,##0', :border => Axlsx::STYLE_THIN_BORDER
percent = styles.add_style :num_fmt => Axlsx::NUM_FMT_PERCENT, :border => Axlsx::STYLE_THIN_BORDER
@wallace
wallace / gist:2492504
Created April 25, 2012 19:23 — forked from thommahoney/gist:2491946
RailsConf 2012 Lightning Talks
5 min:
~Objective-C + Rails:
Communicating w/rails from iOS/mac OS
Dan Hassin
1 min:
~Painless Javascript
koting hatduklgg
with wind tunnel
@wallace
wallace / gist:2492221
Created April 25, 2012 18:53 — forked from thommahoney/gist:2491946
RailsConf 2012 Lightning Talks
1 min:
~Painless Javascript
koting hatduklgg
with wind tunnel
~tenderlove.dup jremsikjr
~iwanttolearnruby.com
(collecting resources for learning ruby)
if Rails.version == '2.3.8' && Gem.available?('mongrel', Gem::Requirement.new('~>1.1.5')) && self.class.const_defined?(:Mongrel)
# Pulled right from latest rack. Old looked like this in 1.1.0 version.
#
# def [](k)
# super(@names[k] ||= @names[k.downcase])
# end
#
module Rack
# config/initializers/cucumber_fakeweb_hook.rb
# If this looks like a test server process, make its FakeWeb available to other
# processes via DRb. That way Cucumber (which runs in a separate process) can
# dynamically register stubs for this server to use.
if Rails.env =~ /^culerity/
require 'drb'
require 'fakeweb'
DRb.start_service("druby://localhost:30010", FakeWeb)
@wallace
wallace / calculator
Created February 18, 2010 18:39 — forked from tdouce/calculator
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type='text/javascript'>
// returns true if the form is valid
@wallace
wallace / bundle-to-ebs.sh
Created January 8, 2010 21:59 — forked from fairchild/bundle-to-ebs.sh
application
#!/bin/bash -xe
EBS_DEVICE='/dev/sdh'
INSTANCE_ID=$1
AKI=${2:-'aki-d314f0ba'}
ARI=${3:-'ari-d014f0b9'}
ARCH=${4:-'x86_64'}
SIZE=${5:-20}
AZ=${6:-'us-east-1a'}
NAME=${7:-"rollbook app"}
Index: intern.h
===================================================================
--- intern.h (revision 22918)
+++ intern.h (working copy)
@@ -268,6 +268,15 @@
VALUE rb_gc_enable _((void));
VALUE rb_gc_disable _((void));
VALUE rb_gc_start _((void));
+VALUE rb_gc_enable_stats _((void));
+VALUE rb_gc_disable_stats _((void));