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
# gem_loc.rb | |
# | |
# Output require-able lines of code gems in your Gemfile | |
# | |
# Usage: rails runner <path to this file> | |
require "rails/code_statistics_calculator" | |
require "csv" | |
gem_specs = Bundler::LockfileParser.new(Rails.root.join("Gemfile.lock").read).specs.each(&:__materialize__) |
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
# Usage: | |
# ticket <= opens ticket associated with the branch you're on (for branch clio-1234-fix-the-thing, opens CLIO-1234) | |
# ticket 5678 <= opens CLIO-5678 | |
ticket () { | |
ticketNumber=$1 | |
if [ "$ticketNumber" -eq "" ] | |
then | |
ticketNumber=$(git rev-parse --abbrev-ref HEAD | ruby -e "branch=gets.downcase;print branch.match(/^clio-(\d+)/)[1] if branch.start_with?('clio-')") | |
fi | |
if [ "$ticketNumber" -eq "" ] |
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 ca.sfu.cq.util.filter; | |
import java.util.regex.Matcher; | |
import java.util.regex.Pattern; | |
public class TimerMessageParser { | |
private String message; | |
public TimerMessageParser(String message) { | |
this.message = message; |
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
{"foo": "bar", "baz": "quux"} |
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
/* The ugly way */ | |
String isSomething = "true" | |
if ( "true".equals(isSomething) ) { | |
/* It takes me a couple seconds to figure out why I'm here */ | |
} | |
/* The easy-to-read way */ | |
String isSomething = true |
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
class Setting < ActiveRecord::Base | |
@@settings = {} | |
belongs_to :record, :polymorphic => true | |
validates_uniqueness_of :key | |
before_save :expire_cache | |
# Retrieve and cache a value for a key |