This file contains hidden or 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
| # | |
| # shell function to print graphite graphs as sparklines in the terminal | |
| # needs https://github.com/holman/spark | |
| # | |
| function graphline() { | |
| GRAPHITEHOST="graphite.example.com" | |
| if [ ! -n "$1" ]; then print "Usage: $0 metric [minutes]"; return 1; fi | |
| if [ ! -n "$2" ]; then MINUTES=10 ; else MINUTES=$2; fi | |
| curl -s "${GRAPHITEHOST}/render?from=-${MINUTES}minutes&target=${1}&format=raw" | cut -d"|" -f 2 | spark ; | |
| } |
This file contains hidden or 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 Rankable | |
| extend ActiveSupport::Concern | |
| included do | |
| field :ratings_value_sum, :type => Integer, :default => 0 | |
| field :ratings_count, :type => Integer, :default => 0 | |
| embeds_many :ratings | |
| end |
This file contains hidden or 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
| jQuery(function() { | |
| $.cookie('tz', (new Date()).getTimezoneOffset()); | |
| }); |
This file contains hidden or 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
| # include this in application controller | |
| module Authentication | |
| protected | |
| # Inclusion hook to make #current_user and #signed_in? | |
| # available as ActionView helper methods. | |
| def self.included(base) | |
| base.send :helper_method, :current_user, :signed_in?, :authorized? if base.respond_to? :helper_method | |
| end | |
| # Returns true or false if the user is signed in. |
This file contains hidden or 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
| # Used to graph results from autobench | |
| # | |
| # Usage: ruby autobench_grapher.rb result_from_autobench.tsv | |
| # | |
| # This will generate three svg & png graphs | |
| require "rubygems" | |
| require "scruffy" | |
| require 'csv' | |
| require 'yaml' |