View raspbian.pi
## 2017 Sept RPi 3 | |
serial gpio to USB requires editing `config.txt` on sdcard, see the following | |
http://elinux.org/RPi_Serial_Connection | |
https://raspberrypi.stackexchange.com/questions/44427/how-to-connect-a-raspberry-pi-3-to-usb-tty-cable | |
## older, older models | |
https://www.raspberrypi.org/downloads/raspbian/ | |
download the image then expand the archive and: |
View throttle.js
function unthrottle(it){ | |
cancelAnimationFrame(it.index); | |
it.node.removeEventListener(it.type, it.throttle); | |
return it; | |
} | |
/** | |
* @param {object} it defines what to throttle, requires 3 properties: | |
* @param {string} it.type event name | |
* @param {Node} it.node DOM element |
View debugiOS.app
/* | |
based on https://gist.github.com/bwdolphin/e7de2d0a21914708bd9a | |
setup: | |
open /Applications/Utilities/Script Editor | |
edit and save | |
System Prefs > Security & Privacy > [Privacy tab] > Accessibility in left sidebar | |
-> add [+] this new app (NOTE must repeat this addition every time the app/script is saved/changed to avoid security errrors) | |
run (eg in the terminal): | |
% cordova run ios && open ./path/to/debugiOS.app/ |
View styleRulesForElementList.js
function styleRulesFor(elementList){ | |
var el, i, out = [], allRules, getMatchedCSSRules, getComputedStyle = window.getComputedStyle; | |
if(!(getMatchedCSSRules=window.getMatchedCSSRules)){ | |
// this is very slow | |
allRules = function(){ | |
// setup when needed | |
var rules = [], i = 0, sheet, styleSheets = el.ownerDocument.styleSheets; | |
while(sheet = styleSheets[i++]){ | |
rules.push.apply(rules, sheet.rules||[]); | |
}; |
View interruptMePlease.ino
/* | |
Bean Loader v 1.9.3 build 1219 | |
Arduino v 1.6.5 | |
previous problem: | |
when I input via D5 using a reed switch (cyclometer head+mount) | |
and smack the sensor with a magnet it often increments by a step of 5 or so, | |
so too much suggesting the interrupt occurs several times instead of the expected single hit | |
for that pass of the magnet by the reed switch |
View LICENSE.txt
The MIT License (MIT) | |
Copyright (c) 2014 TODO | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is | |
furnished to do so, subject to the following conditions: |
View paginate.js
.directive('paginateThis', function(paginate, $parse, $location){ | |
return { | |
restrict: 'A', | |
link: function (scope, elem, attr){ | |
function mapOnToModel(res){ | |
var p = scope.paginate | |
, _esp = JSON.stringify( res.options.query ) | |
, _sort = JSON.stringify( res.options.sort ) | |
; | |
View sortable.js
/** | |
* @ngdoc directive | |
* @name sortable | |
* @restrict A | |
* | |
* @description | |
* setup an object on the scope for handling a list: sorting, filtering, etc | |
* NOTE that track by statements must go at the end of the expression, after the orderBy statement | |
* | |
* @example |
View extend.js
function extend( proto, template ){ | |
var prop; | |
for(prop in template){ | |
try{ | |
if( typeof(template[prop]) === 'function' ){ | |
// relay arguments, using predefined functions where possible | |
proto[ prop ] = proto[ prop ] || (function(prop){ | |
return function(){ return this._xhr[ prop ].apply(this._xhr, arguments); }; | |
})(prop); | |
continue; |
View diff
function diff(defaults, customs, diffs){ | |
/** | |
* @description | |
compare an object against the default returning an object with the differences | |
in the customs object separated out in the returned value | |
when there are no unique values in the customs object undefined is returned | |
* @returns | |
diff value, when no differences undefined, when an object returns object with keys and other values | |
* @example | |
usr.diff(defaults, custom); |