Skip to content

Instantly share code, notes, and snippets.

View franklinjavier's full-sized avatar

Franklin Javier franklinjavier

View GitHub Profile
@franklinjavier
franklinjavier / String.prototype.soundex.js
Created March 29, 2012 03:50 — forked from netojoaobatista/String.prototype.soundex.js
Implementação do algorítimo SoundEX em Javascript
/**
* Implementação do algorítimo SoundEx em Javascript.
* @author João Batista Neto
*
* SoundEX é um algorítimo fonético para indexação de nomes pelo som segundo
* sua pronúncia. O algorítimo foi desenvolvido por Robert C. Russell e
* Margaret K. Odell e patenteado em 1918 e 1922.
* {@link http://en.wikipedia.org/wiki/Soundex}
*
* @return {String}
@franklinjavier
franklinjavier / sample.php
Created August 21, 2012 16:02 — forked from netojoaobatista/sample.php
Slug function
<?php
echo slug('João Batista Neto'); //joao-batista-neto

I'm having trouble understanding the benefit of require.js. Can you help me out? I imagine other developers have a similar interest.

From Require.js - Why AMD:

The AMD format comes from wanting a module format that was better than today's "write a bunch of script tags with implicit dependencies that you have to manually order"

I don't quite understand why this methodology is so bad. The difficult part is that you have to manually order dependencies. But the benefit is that you don't have an additional layer of abstraction.


Mint upgrade procedures

Some investigation and tests on how to upgrade Mint machine.

Tests performed on Mint Cinnamon 14/15/16, on physical machine 14->15 and VirtualBox VMs for 14->15->16 and 14->16.

As usual you could break your machine, so please do backups before and cross fingers.

Mint 14 -> Mint 15

var ws = require('websocket-stream')
var stream = ws('ws://localhost:8343')
stream.on('data', function(o) {
console.log("DATA", o)
})
stream.write(new Buffer('hello'))
/***************************** COPYRIGHT NOTICES ***********************
Some of this code is based on metaphone.c file, which can be found here:
http://www2.varzeapaulista.sp.gov.br/metaphone/
The metaphone port is authored by Carlos Costa Jordao <carlosjordao@gmail.com>
and is covered under this copyright:
Copyright 2014, Carlos Costa Jordao <carlosjordao@gmail.com>.
All rights reserved.
@franklinjavier
franklinjavier / boot.js
Created October 7, 2015 23:47 — forked from jdx/boot.js
zero-downtime node.js app runner
// This script will boot app.js with the number of workers
// specified in WORKER_COUNT.
//
// The master will respond to SIGHUP, which will trigger
// restarting all the workers and reloading the app.
var cluster = require('cluster');
var workerCount = process.env.WORKER_COUNT || 2;
// Defines what each worker needs to run
@franklinjavier
franklinjavier / passport-routes.js
Created October 8, 2015 00:24 — forked from nkbt/passport-routes.js
Passport.js Routes
"use strict";
var passport = require('./passport');
var config = {
redirectBack: redirectBack
}
function redirectBack(req, res) {
res.redirect(req.param('__back') && decodeURIComponent(req.param('__back')) || '/');
}
@franklinjavier
franklinjavier / LazyLoad.js
Created October 10, 2015 14:31 — forked from yocontra/LazyLoad.js
lazy loading react components, useful for video/audio/etc
var React = require('react');
var events = require('add-event-listener');
var isVisible = require('../isVisible');
var LazyLoad = React.createClass({
displayName: 'LazyLoad',
propTypes: {
distance: React.PropTypes.number,
component: React.PropTypes.node.isRequired,
children: React.PropTypes.node.isRequired