Skip to content

Instantly share code, notes, and snippets.

View francisbrito's full-sized avatar
💭
💻 🌴 🇩🇴

Francis Brito francisbrito

💭
💻 🌴 🇩🇴
View GitHub Profile
@francisbrito
francisbrito / mpj.js
Created October 20, 2015 01:35
Demonstrative snippet showing how small, focused functions can abstract implementation details
const selector = '[data-list] [data-scroll-thing]';
function onKeyPressed(event) {
if (isIgnoredKey(event)) return;
const target = event.target;
const letter = getSanitizedLetterFromKey(event.keyCode);
if (!letter) return;
let scrollContainer = getParentElementMatchingSelector(target, selector);
@francisbrito
francisbrito / server.js
Last active September 10, 2015 21:36 — forked from Globik/server
Koa, mongoskin, monk, koa-ejs, koa-passport
var koa = require('koa');
var logger = require('koa-logger');
var path = require('path');
var Router = require('koa-router');
var bodyParser = require('koa-bodyparser');
var render = require('koa-ejs');
'use strict';
module.exports = function bar() {
return 'bar works';
};
@francisbrito
francisbrito / custom_bio.c
Last active August 29, 2015 14:23
Custom BIOs
#include <string.h>
#include <stdlib.h>
#include "custom_bio.h"
BIO_METHOD dotter_method = {
BIO_TYPE_FILTER,
"dotter filter",
dotter_write,
dotter_read,
@francisbrito
francisbrito / babeljs-app.md
Created May 8, 2015 07:00
Ideas for application currently roaming my mind.

Babel App

A minimalist desktop application for compiling ES6/7 to ES5 using Babel.

Specs

  • It should support drag-n-drop.
  • It should report any errors Babel encounters.
@francisbrito
francisbrito / inheritance.js
Last active August 29, 2015 14:19
ES6 & ES5 Inheritance example.
class Animal {
constructor(speciesName) {
this.species = speciesName;
this.extinct = false;
}
isExtinct() {
return this.extinct;
}
}
@francisbrito
francisbrito / index.js
Last active August 29, 2015 14:19
Task concept.
var getProductsPromise = Promise.resolve(['banana', 'apple', 'pear']);
var _do = function (promise) {
var resolved = false,
value = null,
err = null;
promise.then((result) => {
value = result;
@francisbrito
francisbrito / BaseProximitySensor.h
Created March 21, 2015 16:22
Arduino Proximity Sensor PoC.
/***
* BaseProximitySensor.h
* A base class for proximity sensors.
*
* @usage:
* ```cpp
* #include <BaseProximitySensor.h>
*
* BaseProximitySensor *sensor;
*
@francisbrito
francisbrito / BaseAlarm.cpp
Created March 18, 2015 16:42
Arduino Alarm PoC. Sort of a head-scratch approach to the real thing.
#include "Arduino.h"
#include "SerialAlarm.h"
SerialAlarm::SerialAlarm(String msg) {
mMsg = msg;
}
void SerialAlarm::trigger() {
Serial.println(mMsg);
<link rel="import" href="../core-scaffold/core-scaffold.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-menu/core-menu.html">
<link rel="import" href="../core-item/core-item.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-menu/core-submenu.html">
<polymer-element name="my-element">