This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module NullObject | |
extend ActiveSupport::Concern | |
included do | |
const_set("Null#{name}", Class.new) | |
end | |
module ClassMethods | |
def null | |
const_get("Null#{name}").new |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
// mypackage "github.com/danott/mypackage" | |
mypackage "some-clever-service-name-for-versioning-go-programs.com/danott/mypackage/0.0.1" | |
) | |
func main() { | |
mypackage.ExportedFun() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ARGV.join.match("--push-it-to-the-limit") || ENV['ALWAYS_BE_PUSHING_IT_TO_THE_LIMIT'] | |
puts "Pushing it to the limit." | |
system(%[osascript -e 'tell app "Rdio" to play source "t13182620"']) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func doSomethingWithIntish(i int) { | |
// whatever | |
} | |
doSomethingWithInt(1) | |
// type time.Month int | |
doSomethingWithInt(time.January) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
textToRender = "Neato!" | |
fontSizeToRender = 1062 | |
fontSize(fontSizeToRender) | |
width, height = textSize(textToRender) | |
width = width * 1.4 | |
size(width, height) | |
# Centering. Needs to be fine tuned |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "minitest/autorun" | |
class TestSerialComma < MiniTest::Unit::TestCase | |
def possessives | |
%w[hers his yours mine ours] | |
end | |
def test_possessives_1 | |
assert_equal "hers", serial_comma(places.slice(0, 1)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# BAD | |
@get('accessorToManyObjects').length | |
# GOOD | |
@get('accessorToManyObjects.length') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- | |
##################################### | |
TITLE: Daily Events Detailed Report | |
##################################### | |
DESCRIPTION: This reports all the events happening on a day (or span of days) and contains more detailed information (such as answers to questions attached to rooms). The visual style is more appropriate for displaying as a web page. | |
--> | |
<!DOCTYPE html> | |
<html> | |
<head> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
exec < /dev/tty | |
current_branch() { | |
git rev-parse --abbrev-ref HEAD | |
} | |
if current_branch | grep -E "^(staging|master)$" > /dev/null | |
then |