Skip to content

Instantly share code, notes, and snippets.

View jonathanmarvens's full-sized avatar

Jonathan Barronville jonathanmarvens

View GitHub Profile
|---------|
|-----------------|
| |
|-------------------------|
| |
| |
__ |---------------------------------| __
|| | | ||
\--|===| --------- |===|--/
|==| |==|
if ( ! (
Object.create &&
( {} ).toString.call( Object.create ) === '[object Function]'
) ) {
Object.create = function ( members ) {
function Class() {}
Class.prototype = members;
return ( new Class() );
/**
* @author Jonathan Barronville
* @example
* var color_001 = colorShader( '000000', 255 );
* // color_001 === 'ffffff';
* var color_002 = colorShader( 'ffffff', -255 );
* // color_002 === '000000';
* @param {String} color_hex
* @param {Number} amount
* @return {String}
# Initial setup
git clone -o framework -b develop https://github.com/laravel/laravel.git project-name
cd project-name
git checkout --orphan master
git commit -m "Initial commit"
# Pulling changes
git fetch framework
git merge --squash -m "Upgrade Laravel" framework/develop
# Fix merge conflicts if any and commit
@jonathanmarvens
jonathanmarvens / integer-to-binary.js
Created March 19, 2013 01:28
Convert an integer to its binary representation using a simple stack-based algorithm.
function integer_to_binary ( integer ) {
if ( ( toString.call( integer ) !== '[object Number]' ) || ( integer < 0 ) ) {
return null;
} else if ( integer === 0 ) {
return '0';
} else {
var stack = [];
// var STACK_CAPACITY = 8;
@jonathanmarvens
jonathanmarvens / binary_search.js
Created March 14, 2013 09:11
Binary search in multiple languages...
function binarySearch (key, array) {
var low = 0;
var high = (array.length - 1);
while (low <= high) {
var mid = floor(((low + high) / 2));
var val = array[mid];
if (val < key) {
low = (mid + 1);
@jonathanmarvens
jonathanmarvens / javascript-string-format.js
Last active December 12, 2015 12:39
This function extends String adding minimal *printf-like* functionality.
String.prototype.format = function (format_object) {
// TODO: Find better way to do this. Works great for now.
// I don't know how efficient this is, but it works.
var string_current = this.valueOf();
var string_new = '';
var format_matches = string_current.match(/\%\([a-zA-Z0-9_]+\)/g); // Definitely has edge cases.
var replace_object = {};
if (format_matches.length > 0) {

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "[email protected]"
Create separate SSH key for your personal account and your company. Named them with different extensions in your .ssh folder. Upload them to your github account and finally create a config file for your SSH
Create a config file in ~/.ssh/
vim config:
# PERSONAL ACCOUNT Github
Host github.com-COOL
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa_COOL
/* See:
http://bit.ly/WhXvb3
for the Traceur */
var foo = [9, 9, 9],
bar = [2, 2, 2],
baz = [1, 1, ...foo, 1, 1, ...bar, 1, 1];
console.log(baz);
/* Output: 1,1,9,9,9,1,1,2,2,2,1,1 */