Skip to content

Instantly share code, notes, and snippets.

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

Francis Brito francisbrito

💭
💻 🌴 🇩🇴
View GitHub Profile
@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 / 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 / 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 / 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 / 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,
'use strict';
module.exports = function bar() {
return 'bar works';
};
@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');
@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 / index.js
Created January 18, 2016 14:07
Mongorito test example.
const test = require('blue-tape');
const Promise = require('bluebird');
const mongorito = require('mongorito');
/**
* A simple Mongorito Model. Nothing special.
*/
const Post = require('./models').Post;
/**
// foo.js
module.exports = 'foo';
// index.js
var foo = require('./foo');
console.log(foo); // foo
// bar.js
exports.qux = 'qux';
exports.nix = 'nix';