Skip to content

Instantly share code, notes, and snippets.

@yoavniran
yoavniran / ultimate-ut-cheat-sheet.md
Last active April 13, 2024 16:19
The Ultimate Unit Testing Cheat-sheet For Mocha, Chai, Sinon, and Jest
@rowanu
rowanu / README.md
Last active July 30, 2021 02:48
Hotness Widget for the Dashing dashboard from Shopify

Dashing Hotness Widget

Are you dashing? Are you hot? Then you need the Dashing Hotness Widget!

See the blog post for more details.

About

This widget is similar to the basic Number widget, except that the entire widget changes colour based on the value displayed. It is designed to draw attention to

@trcarden
trcarden / gist:3295935
Created August 8, 2012 15:28
Rails 3.2.7 SSL Localhost (no red warnings, no apache config)
# SSL self signed localhost for rails start to finish, no red warnings.
# 1) Create your private key (any password will do, we remove it below)
$ openssl genrsa -des3 -out server.orig.key 2048
# 2) Remove the password
$ openssl rsa -in server.orig.key -out server.key
@romansklenar
romansklenar / string.rb
Last active March 8, 2017 01:20
Ruby string to boolean type casting
class String
def to_bool
case
when self == true || self =~ /^(true|t|yes|y|1)$/i
true
when self == false || self.blank? || self =~ /^(false|f|no|n|0)$/i
false
else
raise ArgumentError.new "invalid value for Boolean: '#{self}'"
@jrom
jrom / nginx.conf
Created February 7, 2012 17:14
nginx hack for multiple conditions
if ($request_uri = /) {
set $test A;
}
if ($host ~* teambox.com) {
set $test "${test}B";
}
if ($http_cookie !~* "auth_token") {
set $test "${test}C";
@jamiequint
jamiequint / stripe_coffeescript
Created December 9, 2011 00:00
Stripe Form Javascript Translated to CoffeeScript
Stripe.setPublishableKey('YOUR_PUBLISHABLE_KEY');
$("#payment-form").submit((event) ->
# disable the submit button to prevent repeated clicks
$('.submit-button').attr("disabled", "disabled")
Stripe.createToken({
number: $('.card-number').val(),
cvc: $('.card-cvc').val(),
exp_month: $('.card-expiry-month').val(),