Skip to content

Instantly share code, notes, and snippets.

View BrianGenisio's full-sized avatar

Brian Genisio BrianGenisio

View GitHub Profile
@BrianGenisio
BrianGenisio / tester.js
Last active November 27, 2018 11:40
Convert *bold* and _italics_ into unicode
function cp(c) {
return c.codePointAt(0);
}
function base(c) {
if (/[a-z]/.test(c)) {
return [cp('a'), cp('𝗮'), cp('𝘢')];
} else if (/[A-Z]/.test(c)) {
return [cp('A'), cp('𝗔'), cp('𝘈')];
}
@BrianGenisio
BrianGenisio / huzzah-feather-adxl-345.js
Created January 17, 2017 02:39
Code to use the Feather Huzzah with the ADXL345
const EtherPortClient = require("etherport-client").EtherPortClient;
const Firmata = require("firmata");
const five = require("johnny-five");
const board = new five.Board({
io: new Firmata(new EtherPortClient({
host: "10.0.1.4", // CHANGE TO YOUR IP ADDRESS
port: 3030
}))
});
@BrianGenisio
BrianGenisio / client.js
Created December 5, 2016 13:13
Example of how to consume Webhooks-Bridge messages.
var socket = require("socket.io-client")("http://webhooks-bridge.herokuapp.com");
socket.on("webhook", function(data){
if(data.webhookId !== '91efd220-b516-11e6-b9ee-3fb14d81574f') return;
console.log("Webhook Received: ", data.name, data.query);
});
@BrianGenisio
BrianGenisio / AppController.js
Created June 29, 2016 00:58
Using Aphrodite in Angular
import angular from 'angular';
import { StyleSheet, css } from 'aphrodite';
import '../style/app.css';
const styles = StyleSheet.create({
red: {
backgroundColor: 'red'
},
<script type="text/javascript" src="http://cdn.jsdelivr.net/clippy.js/1.0/clippy.min.js"></script>
<link rel="stylesheet" type="text/css" href="http://cdn.jsdelivr.net/clippy.js/1.0/clippy.min.css" media="all">
<script type="text/javascript">
clippy.load('Clippy', function(agent) {
agent.show();
agent.speak('Hello! It looks like you are trying to log in! I\'m here to help.');
setInterval(function() {
agent.animate();
async componentDidMount() {
let busRoutes = await BusRouteStore.getAll();
this.setState({busRoutes});
}
module.exports = function(grunt) {
require('load-grunt-tasks')(grunt);
// Project configuration.
grunt.initConfig({
browserify: {
app_dev: {
options: {
watch: true,
keepAlive: false,
@BrianGenisio
BrianGenisio / ir.reflectance.array.md
Created November 19, 2014 17:42
The markdown for the Johnny-Five wiki to describe the Reflectance Array

The IR.Reflect.Array class constructs an array of analog (digital arrays are not currently supported) reflectance sensors like the QTR-8A from Pololu.

Parameters

  • pins An array Numbers or Strings for the analog sensor pins.

  • emitter The pin where the emitter LED is attached. For these arrays, there is one pin that controls all of the emitters.

var eyes = new five.Sensor({
@BrianGenisio
BrianGenisio / bot.js
Created November 15, 2014 02:10
Line following robot using IR.Reflect.Array
// Video: http://youtu.be/i6n4CwqQer0
var fs = require("fs"),
five = require("johnny-five"),
ReflectArray = require("./reflect.array"),
board = new five.Board();
var stdin = process.stdin;
stdin.setRawMode(true);
stdin.resume();
@BrianGenisio
BrianGenisio / bot.js
Created November 2, 2014 02:00
Using a PID controller to keep a bot close to the wall
var five = require("johnny-five"),
board = new five.Board(),
PID = require('pid-controller');
board.on("ready", function() {
console.log('ready');
var sampleRate = 10;
/////////////////////////////////////////
// CONFIGURE SERVOS AND PING SENSORS