Skip to content

Instantly share code, notes, and snippets.

/**
Takes a dividend and a divisor and returns a quotient.
```
divide(4,2);
//2
var divTen = divide(10);
divTen(2);
//5
#include "Adafruit_Thermal.h"
// Pass addr to printer constructor
Adafruit_Thermal printer(&Serial1);
Adafruit_Thermal printer2(&Serial3);
// -----------------------------------------------------------------------
void setup() {
@constellates
constellates / gist:a76132ed7de74610a435
Last active June 16, 2017 13:25
React OAuth 2 user store with Hello.js
// dependencies ----------------------------------------------------------------------
import Reflux from 'reflux';
import Actions from '../actions/Actions';
import request from 'superagent';
import config from '../config';
let UserStore = Reflux.createStore({
// store setup -----------------------------------------------------------------------
@constellates
constellates / gist:00ebcd0e1293c3e28c8e
Last active August 29, 2015 14:15
Overlay Directive
angular.module('app').directive('overlay', overlay);
function overlay () {
return {
restrict: 'E',
transclude: true,
scope: {active: '=', text: '='},
template: '<div class="introjs-overlay" ng-show="active" ng-click="active = false;"></div>' +
'<div class="mock-intro" ng-show="active">' +
'<div class="mock-intro-text" ng-show="active">{{text}}</div>' +
@constellates
constellates / timeago.filter.js
Last active August 29, 2015 14:03 — forked from rodyhaddad/timeago.filter.js
A time ago filter with built in timezone conversion from a UTC time source.
.filter('timeago', function () {
/*
* time: the time
* local: compared to what time? default: now
* raw: wheter you want in a format of "5 minutes ago", or "5 minutes"
*/
// parse string date to milliseconds
// Note: months are 0-based