Skip to content

Instantly share code, notes, and snippets.



View GitHub Profile
View gist:8e4592ccba4d42522200
-- invoices
SELECT AS user_id,
uuid_timestamp( AS dt,
sum(i.balance) AS inc_amt
FROM public.users u
JOIN public.invoices i ON = i.user_id
u.fraud_score != 'F'
AND uuid_timestamp( > DATE '2015-06-30'
# Convert an animated video to gif
# Works best for videos with low color palettes like Dribbble shots
# @param $1 - video file name like ``
# @param @optional $2 - resize parameter as widthxheight like `400x300`
# Example: vidtogif 400x300
# Requirements: ffmpeg and gifsicle. Can be downloaded via homebrew
arush / gist:5777408
Created Jun 13, 2013
Example gruntfile using ngmin for pre-minification of angular apps
View gist:5777408
module.exports = (grunt)->
# Run `grunt server` for live-reloading development environment
#grunt.registerTask('server', [ 'build', 'livereload-start', 'karma:background', 'express', 'regarde' ])
grunt.registerTask('server', [ 'build', 'express', 'watch' ])
# Run `grunt test` (used by `npm test`) for continuous integration (e.g. Travis)
grunt.registerTask('test', [ 'build', 'karma:unit' ])
# Run `grunt test:browsers` for real-world browser testing
View gist:5397620
// You can do that in your Chrome Console
// Load the initial object, like an Attempt
var attempt = new Parse.Object("Attempt"); = "myId";
// Get the relation "handler" from the attempt object
var relation = attempt.relation("products");
View gist:4568413
info: Creating snapshot 0.0.1-22
info Uploading: [=============================] 100%
info: Updating app shinobi
error: Error running command deploy
error: Nodejitsu Error (500): Internal Server Error
warn: Error returned from Nodejitsu
error: Error: App domain already exists
error: at function).updateCounts.(anonymous function) (/root/nodejitsu/lib/nodejitsu/resources/app/controller/update.js:89:28)
error: at Resource._request (/root/nodejitsu/node_modules/resourceful/lib/resourceful/resource.js:184:13)
error: at Function.Resource.runAfterHooks (/root/nodejitsu/node_modules/resourceful/lib/resourceful/resource.js:93:12)
View recurly-client-node.js
var crypto = require('crypto')
, uuid = require('node-uuid');
function recurly () {
recurly.prototype.sign = function (privateKey, params) {
var protectedString = makeProtectedString(params);
var secureHash = makeHash(privateKey, protectedString);
var signature = secureHash+"|"+protectedString;
arush / gist:4267237
Created Dec 12, 2012
Facebook getLoginStatus for testing
View gist:4267237
FB.getLoginStatus(function(response) {
if (response.status === 'connected') {
alert("yes am connected");
} else if (response.status === 'not_authorized') {
alert("logged into facebook but not authorized your app");
} else {
alert("not logged into facebook");
arush / gist:4216462
Created Dec 5, 2012
Recurly Push notifications
View gist:4216462
<?xml version="1.0" encoding="UTF-8"?>
<username nil="true"></username>
View gist:4118976
NB: this is being generated by the server side MVC, so url is
<!-- deleted lots of header stuff -->
<div id="maleContainer" class="container withShadow">
<div class="maleApp" ng-app="ngMaleApp">
<div class="content" ng-view>
View gist:4118911
'use strict';
var ngMaleApp = angular.module('ngMaleApp', ['MyDirectives','DataServices','ui'])
.config(['$routeProvider', function($routeProvider) {
.when('/', {
templateUrl: '/male/views/menu',
controller: 'MainCtrl'