Skip to content

Instantly share code, notes, and snippets.

View denniskuczynski's full-sized avatar

Dennis Kuczynski denniskuczynski

View GitHub Profile
(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();
@denniskuczynski
denniskuczynski / mixins.js
Last active September 30, 2017 15:48
ES6 Mixins
// Mixins with just Object.assign
// (Could have used _.extend without ES6)
(function() {
"use strict";
// Define 3 Mixins Related to Vehicles
var HasWheels = {
@denniskuczynski
denniskuczynski / rhino-handlebars-precompiler.js
Last active December 16, 2015 15:18 — forked from selvakn/rhino-handlebars-precompiler.js
update to scan the directory recursively
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() {
@denniskuczynski
denniskuczynski / miniprofiler_turbolinks.coffee
Created December 14, 2012 22:08
Script to allow MiniProfiler to work with Rails using the Turbolinks gem
@denniskuczynski
denniskuczynski / get_random_facebook_profile_image.rb
Created August 23, 2012 20:30
Silly Script to Download Some Random Facebook Profile Images
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 = ''
@denniskuczynski
denniskuczynski / index_view.js
Created July 9, 2012 00:30
Example Backbone.JS View
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"}))
@denniskuczynski
denniskuczynski / fake_sidekiq.rb
Created June 29, 2012 14:32
Test helper for Faking Sidekiq Client Enqueues
##
# 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!
@denniskuczynski
denniskuczynski / user.rb
Created June 25, 2012 18:07
Example of User including DeviseAsync helper
class User
devise :database_authenticatable, :confirmable
include DeviseAsync
end
@denniskuczynski
denniskuczynski / devise_async.rb
Created June 25, 2012 18:03
Override Devise email logic for sending asynchronously with Sidekiq
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
@denniskuczynski
denniskuczynski / thing_spec.rb
Created June 22, 2012 21:43
Spec with Example option passed in
describe Thing do
it "should fire after_commit", :with_transaction_callbacks => true do
#do something that fires a commit
#check firing
end
end