Skip to content

Instantly share code, notes, and snippets.

View Sinetheta's full-sized avatar

Kevin Attfield Sinetheta

View GitHub Profile
@Sinetheta
Sinetheta / promisify.js
Created October 4, 2016 07:04
A jquery plugin for wrapping a function with a promise
// Wrap a function and return a promise instead of accepting a callback.
//
// @param target [Function] the function to be wrapped. This function *must*
// accept a callback as its last argument of the form `function(err, data) {}`.
// @param args [Array] an array of the arguments for the target function.
// Not including the final callback, which will be provided by promisify.
// @return [Promise] A jQuery promise object which will resolve or reject
// based on the arguments passed to the callback.
function promisify(fun, args, self) {
var d = $.Deferred();
@Sinetheta
Sinetheta / order_completed.erb
Created November 10, 2016 04:16
segment order complete
<script>
analytics.track('Order Completed', {
order_id: '<%= j order.number %>',
affiliation: '<%= current_store.name %>',
total: '<%= order.total %>',
shipping: '<%= order.ship_total %>',
tax: '<%= order.tax_total %>',
discount: '<%= (- order.promo_total) %>',
coupon: '<%= order.coupon_code %>',
currency: '<%= order.currency %>',
# A script to help setup S3 for new projects using aws sdk
#
# - Create new S3 bucket <prompt for bucket name>
# - [optional] configure bucket as website
# - [optional] configure bucket as publicly readable
# - Create new IAM user <prompt for user name>
# - Create new customer managed policy for full S3 access to new bucket only
# - Attach policy directly to new user
# - Create and print API access keypair
#
### Keybase proof
I hereby claim:
* I am sinetheta on github.
* I am sinetheta (https://keybase.io/sinetheta) on keybase.
* I have a public key ASBB3vf88ZLQjHDf7HO4FwtmvxTXWghhzjn-1EK2q58YHAo
To claim this, I am signing this object: