Skip to content

Instantly share code, notes, and snippets.

View reconbot's full-sized avatar
🏴‍☠️

Francis Gulotta reconbot

🏴‍☠️
View GitHub Profile
@reconbot
reconbot / es-client.js
Last active December 19, 2016 03:46
Trying to make aws4 work with got and elastic search
import AWS from 'aws-sdk'
import aws4 from 'aws4'
import bole from 'bole'
import got from 'got'
import Promise from 'bluebird'
import config from './config'
const logger = bole('es-client')
const { region, host } = config
// This is what elastic search wants for promises, bluebird says it's horrible
// https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/configuration.html#config-defer
// http://bluebirdjs.com/docs/api/deferred-migration.html
function defer () {
let resolve, reject
var promise = new Promise(function makeDefer () {
resolve = arguments[0]
reject = arguments[1]
})
return {
'use strict';
var SerialPort = require('./');
var port = process.env.TEST_PORT;
if (!port) {
console.error('Please pass TEST_PORT environment variable');
process.exit(1);
}
var five = require("johnny-five");
var board = new five.Board();
board.on("ready", function() {
// Create an Led on pin 13 and strobe it on/off
var led = new five.Led(13)
// Optionally set the speed; defaults to 100ms
led.strobe(100);
});
module.exports = function stickyNav() {
var $nav = $(".navigation");
var $selector = $(".closed");
if (!$selector.get(0)){
return;
}
var thresholdHeight = $selector.position().top - $nav.height();
var toggled = false;
var toggleNavClass = function() {

Keybase proof

I hereby claim:

  • I am reconbot on github.
  • I am reconbot (https://keybase.io/reconbot) on keybase.
  • I have a public key whose fingerprint is 44E1 DFA3 5E53 69A1 6B1E 30BB 3820 C498 CBDB 3B45

To claim this, I am signing this object:

@reconbot
reconbot / esp.js
Last active January 20, 2016 20:27
var boards = new five.Boards([
{ id: "arduino-or-whatever" },
{ id: "a", io: new Esp({ id: "a"}) },
{ id: "b", io: new Esp({ id: "b"}) },
]);
boards.on("ready", function() {
var [arduino, a, b] = this;
// which is the same as...
// var arduino = this[0];
                           CommonJS Require Mapping
     +-----------------+
     |     MODULE      |        +------------------+
     |       A         |        |     MODULE       |
     +----------+------+        |       C          |
                |               +-------+----------+
                |                       |
                |                       |
             +--v----------------+      |
@reconbot
reconbot / importing-exporting-examples.js
Last active May 9, 2025 03:34
CommonJS to ES modules test cases
// CommonJS to ES modules test cases
// Importing
var foo = require('bar');
// becomes
import foo from 'bar';
require('bar')(foo);
// becomes