Skip to content

Instantly share code, notes, and snippets.

View ready4god2513's full-sized avatar

Brandon Hansen ready4god2513

View GitHub Profile
PUBNUB.subscribe({
channel : "/path",
message : function(message)
{
$("#current-view-count").html(message.viewerCount);
}
})
foreach($chartbeat->top as $top)
I have seen this-
[shortcode]
do stuff
[/shortcode]
But I have not see this-
[shortcode]
do stuff
@ready4god2513
ready4god2513 / gist:4217908
Created December 5, 2012 17:56
Orange Tree Problem
# Make an OrangeTree class. It should have a height method which returns its height, and a oneYearPasses method,
# which, when called, ages the tree one year. Each year the tree grows taller (however much you think an orange tree
# should grow in a year), and after some number of years (again, your call) the tree should die. For the first few years,
# it should not produce fruit, but after a while it should, and I guess that older trees produce more each year
# than younger trees... whatever you think makes most sense. And, of course, you should be able to countTheOranges
# (which returns the number of oranges on the tree), and pickAnOrange (which reduces the @orangeCount by one and
# returns a string telling you how delicious the orange was, or else it just tells you that there are no more
# oranges to pick this year). Make sure that any oranges you don't pick one year fall off before the next year.
class OrangeTree
@ready4god2513
ready4god2513 / gist:3941488
Created October 23, 2012 20:55
Stupid deprecation issues that I can't fix. So I will fix them.
class Object
def puts(str)
super unless str.include?("DEPRECATION WARNING: Passing a template handler")
end
def print(str)
super unless str.include?("DEPRECATION WARNING: Passing a template handler")
end
it "should remove previous answers before adding new ones" do
question.answers.should be_empty
question.answers = [Answer.new(result: result, choices: [choice])]
question.answers.count.should == 1
question.answers = [Answer.new(result: result, choices: [choice2])]
question.answers.count.should == 1
end
@ready4god2513
ready4god2513 / gist:3493388
Created August 27, 2012 23:34
My .gitconfig file
[user]
name = Brandon Hansen
email = brandonh@ibethel.org
[core]
excludesfile = /Users/brandon/.global_ignore
editor = mate -w
[color]
ui = auto
[grep]
# Enable POSIX extended regex
@ready4god2513
ready4god2513 / youversion.user.js
Created March 19, 2012 19:04
Turn the page on youversion via keyboard shortcuts. This is a Chrome Userscript that can be installed by saving as youversion.user.js and dragging in to Chrome.
// ==UserScript==
// @name Simple YouVersion Keyboard Pagination
// @author Brandon Hansen (https://github.com/ready4god2513)
// @description Turn the page on youversion via keyboard shortcuts. This is a Chrome Userscript that can be installed by saving as youversion.user.js and dragging in to Chrome.
// @match http://*.youversion.com/bible/*
// ==/UserScript==
document.onkeydown = function(e)
{
if(e.keyCode == 37)
@ready4god2513
ready4god2513 / corruptgem.bash
Created October 26, 2011 03:27
Gem::Package::FormatError: corrupt gem
brandon$ bundle
Fetching source index for http://rubygems.org/
Using rake (0.9.2.2)
Using log4r (1.1.9)
Using XMLCanonicalizer (1.0.1)
Using multi_json (1.0.3)
Using activesupport (3.1.1)
Using builder (3.0.0)
Using i18n (0.6.0)
Using activemodel (3.1.1)
operator = "t"
number = Integer("2")
if operator =~ /^t/
calc = -> n { n * number }
else
calc = -> n { n + number }
end
puts (1..10).collect(&calc).join(", ")
#!/bin/sh
# THE PROBLEM HERE IS THAT WITHOUT HARD-CODING THE PATH
# IT MAY HAVE SOME ISSUES.
BASEPATH=$PWD
# THE BASIC ACTIONS
actions=( index new_one create edit update delete )