Skip to content

Instantly share code, notes, and snippets.

View brandon-beacher's full-sized avatar
💭
🦑

Brandon Beacher brandon-beacher

💭
🦑
View GitHub Profile
def ago(date_or_time)
return nil unless date_or_time
date_or_time.to_time < Time.now ? "#{time_ago_in_words(date_or_time)} #{I18n.t('time_ago')}" : "#{time_ago_in_words(date_or_time)} #{I18n.t('time_from')}"
end
development:
adapter: postgresql
encoding: unicode
database: passion-dragon_development
min_messages: warning
test:
adapter: postgresql
encoding: unicode
database: passion-dragon_test
GPB.Controls.Stencil.Audio = function (stencil) {
var API = { constructor: GPB.Controls.Stencil.Audio }
API.maskTagName = 'div';
API.findElements = function (doc) {
return doc.querySelectorAll('.audio-placeholder');
}
API.fitMask = function (audioPlaceholder, audioMask) {
module ApplicationHelper
def s3_upload_form_tag(bucket, subfolder = "uploads", presigned_post_options = {}, html_options = {}, &block)
key = [
subfolder,
SecureRandom.urlsafe_base64,
'${filename}' ].reject(&:blank?).join('/')
s3 = AWS::S3.new
bucket = s3.buckets[bucket]
class GoodFollower
def self.connect(&block)
begin
temporarily_connect_to_follower
yield
ensure
restore_connection_to_leader
end
end
= form_tag material_rating_path(@material) do
.btn-group
= button_tag class: "btn btn-rating", name: "rating", value: -2 do
= image_tag "negative_two_rating.png"
span.badge.badge-important --
= button_tag class: "btn btn-rating", name: "rating", value: -1 do
= image_tag "negative_one_rating.png"
span.badge.badge-warning -
= button_tag class: "btn btn-rating", name: "rating", value: 0 do
= image_tag "zero_rating.png"
addDate: '2011-05-31T20:15:20.000Z'
assetURI: http://concept.goorulearning.org/repository/
batchId:
brokenStatus: 0
category: Exam
codes:
contentId: 18807
contentType:
createdOn:
creator:
#compdef rake
if [[ -f Rakefile ]]; then
local recent=$(ls -t .rake_tasks~ Rakefile **/*.rake | head -n 1)
if [[ $recent != .rake_tasks~ ]]; then
rake --tasks | cut -d ' ' -f 2 > .rake_tasks~
fi
compadd $(cat .rake_tasks~)
fi
☁ gooru [master] tconsole -o all
Welcome to tconsole (v1.2.5). Type 'help' for help or 'exit' to quit.
Loading environment...
Environment loaded in 0.076461s.
Running tests...
Run options: --seed 15398
class Follower
def self.connect(&block)
if Stage.production?
connect_to_follower(&block)
else
yield
end
end