Skip to content

Instantly share code, notes, and snippets.

View bmeck's full-sized avatar

Bradley Farias bmeck

View GitHub Profile
@bmeck
bmeck / hmr.js
Created March 20, 2020 13:56 — forked from georges-gomes/hmr.js
Hot module reload prototype
import inspector from "inspector";
const url2scriptid = new Map<string, string>();
const session = new inspector.Session();
session.connect();
setupDebugger();
function setupDebugger() {
@bmeck
bmeck / example.md
Last active June 27, 2018 21:57 — forked from jamiebuilds/example.md
`/my-website/` - `package.json`
`/src/`
`/pages/` - `index.html` - `about.html`
`/assets/` - `site.css` - `site.js`
@bmeck
bmeck / echoHttpRequest.js
Last active August 29, 2015 14:08 — forked from Marak/echoHttpRequest.js
Transparent log http req
module['exports'] = function echoHttp (hook) {
hook.debug(hook.params);
hook.debug(hook.req.path);
hook.debug(hook.req.method);
hook.req.pipe(hook.res);
@bmeck
bmeck / gist:8110130
Last active January 1, 2016 07:09 — forked from getify/gist:8109596
function collectLikes(arr) {
arr = Array.prototype.slice.call(arr);
if (arr.length) {
// our current type
var current_type = typeof arr[0];
// our start of type
var left = 0;
return arr.reduce(function (current, value, index, arr) {
// only need to do work if type is different
if (typeof value !== current_type) {
var directories = [
'./app',
'./app/controllers',
'./app/helpers',
'./app/repositories',
'./app/validations',
'./app/views',
'./app/views/partials'
]
@bmeck
bmeck / starttls.js
Created April 26, 2011 15:15 — forked from TooTallNate/starttls.js
Upgrade a regular `net.Stream` connection to a secure `tls` connection.
// Target API:
//
// var s = require('net').createStream(25, 'smtp.example.com');
// s.on('connect', function() {
// require('starttls')(s, options, function() {
// if (!s.authorized) {
// s.destroy();
// return;
// }
//
@bmeck
bmeck / screening.js
Created September 14, 2010 20:40 — forked from rmurphey/screening.js
// 1: how could you rewrite the following to make it shorter?
if (foo) {
bar.doSomething(el);
} else {
bar.doSomethingElse(el);
}
@bmeck
bmeck / screening.js
Created September 14, 2010 20:39 — forked from rmurphey/screening.js
// 1: how could you rewrite the following to make it shorter?
if (foo) {
bar.doSomething(el);
} else {
bar.doSomethingElse(el);
}