Skip to content

Instantly share code, notes, and snippets.

@Arwid
Arwid / flowsensortest.py
Created June 15, 2018 15:35
FlowSensorTest
#!/usr/bin/python
# Originally From: https://www.raspberrypi.org/forums/viewtopic.php?t=118230
import RPi.GPIO as GPIO
import time, sys
import datetime
FLOW_SENSOR = 17
GPIO.setmode(GPIO.BCM)
_ = require "lodash"
DEFAULT_OPTIONS =
filter: /_/
silent: false
camelize = (obj, options) ->
options = _.merge {}, DEFAULT_OPTIONS, options
methodNames = _
@Arwid
Arwid / migrations.js
Created June 20, 2017 21:46 — forked from vincentbernat/migrations.js
Test database migration result with Sequelize.js
'use strict';
var setup = require('../.'),
should = require('should'),
path = require('path'),
Sequelize = require('sequelize'),
db = require('../../lib/db'),
config = require('../../lib/config'),
logger = require('../../lib/logger');
#!/bin/sh
git filter-branch --env-filter '
OLD_EMAIL="[email protected]"
CORRECT_NAME="Your Correct Name"
CORRECT_EMAIL="[email protected]"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
@Arwid
Arwid / recompileOn.js
Last active August 29, 2015 14:27
AngularJS RecompileOn Directive
// Forked from: https://medium.com/@kentcdodds/angularjs-one-time-bindings-and-recompiling-templates-9857b2cead01
/* global angular */
var directives = angular.module('directives');
directives.directive('recompileOn', ['$parse', function($parse) {
'use strict';
return {
transclude: true,
link: function link(scope, $el, attrs, ctrls, transclude) {
@Arwid
Arwid / get-watchers.js
Last active August 29, 2015 14:27 — forked from kentcdodds/get-watchers.js
Get Watchers of element and its children
function getWatchers(root) {
root = angular.element(root || document.documentElement);
var watcherCount = 0;
function getElemWatchers(element) {
var isolateWatchers = getWatchersFromScope(element.data().$isolateScope);
var scopeWatchers = getWatchersFromScope(element.data().$scope);
var watchers = scopeWatchers.concat(isolateWatchers);
angular.forEach(element.children(), function (childElement) {
watchers = watchers.concat(getElemWatchers(angular.element(childElement)));
@Arwid
Arwid / evaluateExpressions.js
Last active August 29, 2015 14:27
lodash extension to evaluate expressions
// lodash extension to evaluate expressions
_.eval = function(expression, scope) {
return _.template("<%= " + expression + " %>")(scope);
}
_.eval = function(expression) {
return _.template("<%= " + expression + " %>");
}
How to setup Heroku Hostname SSL with GoDaddy SSL Certificate and Zerigo DNS
Heroku recently added an exciting new 'Hostname SSL' option. This option offers the broad compatibility of IP-based SSL, but at 1/5 the price ($20 / month at the time of this writing).
The following tutorial explains how to use Heroku's new 'Hostname SSL' option on your Heroku project. Before we begin, let's list what we're using here:
* Heroku Hostname SSL
* GoDaddy Standard SSL Certificate
* Zerigo DNS
@Arwid
Arwid / HideMobileAddressBar.js
Created March 19, 2012 04:10 — forked from mhammonds/HideMobileAddressBar.js
Hide Browser Address Bar - Android + iPhone
function hideAddressBar()
{
if(!window.location.hash)
{
if(document.height < window.outerHeight)
{
document.body.style.height = (window.outerHeight + 50) + 'px';
}
setTimeout( function(){ window.scrollTo(0, 1); }, 50 );
@Arwid
Arwid / Gemfile
Created January 7, 2012 23:07
Sprockets compilation of assets
source 'http://rubygems.org'
gem 'sass'
gem 'coffee-script'
gem 'yui-compressor'
gem 'handlebars_assets'
gem 'sprockets'
gem 'rb-fsevent'