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
(function() { | |
$(document).ready(function() { | |
var d3data; | |
$('button.points').on('click', function() { | |
var i = 0; | |
var points = parseInt($('input.points').val(), 10); | |
var maxValue = 10000; | |
var types = _.range(10); | |
var curTime = new Date().getTime(); |
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
// Mixins with just Object.assign | |
// (Could have used _.extend without ES6) | |
(function() { | |
"use strict"; | |
// Define 3 Mixins Related to Vehicles | |
var HasWheels = { |
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
importPackage(java.io); | |
importPackage(java.util); | |
(function(args) { | |
var templateFileExtension = 'handlebars', | |
output = ['// This file is auto-generated and should be ignored from version control.\n'], | |
console = { | |
log: print | |
}, | |
showUsage = function() { |
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
# Store detached versions of body tags inserted by MiniProfiler when fetching a new page with Turbolinks | |
storeMiniProfileBodyTags =-> | |
if $('#mini-profiler').length and not window.MiniProfileBodyTags | |
window.MiniProfileBodyTags = {} | |
window.MiniProfileBodyTags.Container = $('.profiler-results').detach() | |
window.MiniProfileBodyTags.Templates = $('script[type="text/x-jquery-tmpl"]').detach() | |
# Copy detached tags back into the body when changing pages with Turbolinks | |
migrateMiniProfileBodyTags =-> | |
if window.MiniProfileBodyTags |
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
require "rest_client" | |
MISSING_IMAGE_RESPONSE = RestClient.get "https://graph.facebook.com/012345678/picture?type=large" | |
QUESTION_MARK_IMAGE_RESPONSE = RestClient.get "https://graph.facebook.com/2252150634/picture?type=large" | |
DIGITS = (0..9).to_a | |
def get_random_facebook_profile_image(image_path, max_tries=200) | |
for tries in 0..max_tries | |
# Generate a random 9 digit identifier | |
random_id = '' |
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
App.Views.Examples ||= {} | |
class App.Views.Examples.IndexView extends Backbone.View | |
template: JST["backbone/templates/examples/index"] | |
render: -> | |
this.el.html((@template({title:"Example Title"})) |
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
## | |
# Test helper for Faking Sidekiq Client Enqueues | |
# To use, include in your spec/support directory. | |
# Sidekiq::Client will be opened and have the fake methods added | |
# | |
# To use, call FakeSidekiq.fake! before your test, and | |
# FakeSidekiq.unfake! after your test. e..g | |
# | |
# before(:each) do | |
# FakeSidekiq.fake! |
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
class User | |
devise :database_authenticatable, :confirmable | |
include DeviseAsync | |
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
module DeviseAsync | |
####################################################################### | |
# Override Devise email logic for sending asynchronously with Sidekiq # | |
####################################################################### | |
def self.included(clazz) | |
clazz.class_eval do | |
public | |
after_commit :send_pending_notifications |
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
describe Thing do | |
it "should fire after_commit", :with_transaction_callbacks => true do | |
#do something that fires a commit | |
#check firing | |
end | |
end |
NewerOlder