Install needed node packages:
npm install -g cylon-ble
npm install cylon cylon-ollie
First scan for your BB8 (the device name should contain BB in it):
> sudo cylon-ble-scan
[...]
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
app.directive('infiniteScroll', [ | |
'$rootScope', '$window', '$timeout', function($rootScope, $window, $timeout) { | |
return { | |
link: function(scope, elem, attrs) { | |
var checkWhenEnabled, handler, scrollDistance, scrollEnabled; | |
$window = angular.element($window); | |
elem.css('overflow-y', 'scroll'); | |
elem.css('overflow-x', 'hidden'); | |
elem.css('height', 'inherit'); | |
scrollDistance = 0; |
Install needed node packages:
npm install -g cylon-ble
npm install cylon cylon-ollie
First scan for your BB8 (the device name should contain BB in it):
> sudo cylon-ble-scan
[...]
Given an Array of Functions fns
, what argument(s) can you pass to fns.forEach
such that each function in fns
will execute, in order, without creating any anonymous (or named) functions or invoking the Function
constructor?
function
keyword, or arrow functions () =>
.Function
constructor.Function#bind
& friends on the Function.prototype
are ok.#Comprehensive Introduction to @ngrx/store By: @BTroncone
Also check out my lesson @ngrx/store in 10 minutes on egghead.io!
Update: Non-middleware examples have been updated to ngrx/store v2. More coming soon!
When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:
var Article = require('../../../models/article');
Those suck for maintenance and they're ugly.
var crypto = require("crypto"); | |
/** | |
* Get the signature/digest of a supplied input string | |
* @param data [Required] The String to encode | |
* @param awsSecretKey [Required] Secret key shared with Amazon | |
* @param algorithm [Optional] Encryption algorithm, defaults to sha256 | |
* @param encoding [Optional] The output encoding. Default to base64 | |
* @returns Str with encoded digest of the input string | |
*/ | |
function generateHmac (data, awsSecretKey, algorithm, encoding) { |
// Getting a file through XMLHttpRequest as an arraybuffer and creating a Blob | |
var rhinoStorage = localStorage.getItem("rhino"), | |
rhino = document.getElementById("rhino"); | |
if (rhinoStorage) { | |
// Reuse existing Data URL from localStorage | |
rhino.setAttribute("src", rhinoStorage); | |
} | |
else { | |
// Create XHR and FileReader objects | |
var xhr = new XMLHttpRequest(), |
<!doctype html> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<title>AWS IoT Pub/Sub Demo</title> | |
</head> | |
<body> | |
<h1>AWS IoT Pub/Sub Demo</h1> | |
<form> | |
<button type="button" id="connect">connect!</button> |