Skip to content

Instantly share code, notes, and snippets.

@ruzz311
ruzz311 / BeautifulFaces.js
Last active December 14, 2015 07:39 — forked from joelongstreet/BeautifulFaces.js
BeautifulFaces.js (for NVM users) Dependencies: imagesnap (http://iharder.sourceforge.net/current/macosx/imagesnap/) Description: Save this script as a post-commit hook to snap a photo of yourself and save it with your commit message
#!/usr/bin/env node
//
// BeautifulFaces.js
// https://gist.github.com/joelongstreet/5052198
//
// Dependencies:
// imagesnap (npm install -g imagesnap)
// Description:
// Save this script as a post-commit hook to snap a photo of yourself and
// save it with your commit message
// install the 'request' package first with 'npm install request'
var request = require('request');
// replace with your Keen IO project token
var projectToken = "501999234-FAKE-PROJECT-ID";
// create a sample JSON event for an event collection
var eventCollection = "meals";
var sampleEvent = {
username: "ralph",
@ruzz311
ruzz311 / Gruntfile.js
Created July 11, 2013 20:13 — forked from kristoferjoseph/Gruntfile.js
Helpful build config
/*global module:false, require:false*/
var path = require('path'),
lrSnippet = require('grunt-contrib-livereload/lib/utils').livereloadSnippet;
var folderMount = function folderMount(connect, point) {
return connect.static(path.resolve(point));
};
module.exports = function(grunt) {
/**
* iOS 6 style switch checkboxes
* by Lea Verou http://lea.verou.me
*/
:root input[type="checkbox"] { /* :root here acting as a filter for older browsers */
position: absolute;
opacity: 0;
}
import DS from 'ember-data';
import Adapter from "ember-data/adapters/rest";
const { errorsHashToArray } = DS;
export default Adapter.extend({
handleResponse(status, headers, payload) {
if (this.isInvalid(...arguments)) {
payload.errors = errorsHashToArray(payload.errors);
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
actions: {
error(error, transition){
transition.send('setFlashMessage', 'ANOTHER ERRRR');
}
}
});
@ruzz311
ruzz311 / gist:0ce510792b317e7b6be93f6d0e752a18
Created July 26, 2020 13:24 — forked from riston/gist:3016944
Random number generating (Box-Muller)
var Random = {
/**
* Numbers between ~( -2 to 2 )
* http://stackoverflow.com/questions/75677/converting-a-uniform-distribution-to-a-normal-distribution
* http://c-faq.com/lib/gaussian.html
*/
gaussian: function() {
var x1, x2, r;