Skip to content

Instantly share code, notes, and snippets.

View jonatasnona's full-sized avatar
🇧🇷
Working from home

Jonatas Pedraza jonatasnona

🇧🇷
Working from home
View GitHub Profile
@jonatasnona
jonatasnona / key-fingerprint
Created March 7, 2012 18:45 — forked from yosemitebandit/key-fingerprint
SSH: print ssh public key's fingerprint
$ ssh-keygen -l -f id_rsa.pub
2048 aa:bb:cc:dd:ee:ff:00:11:22:33:44:55:66:77:88:99 id_rsa.pub (RSA)
@jonatasnona
jonatasnona / snippet.js
Created March 9, 2012 20:28 — forked from necolas/snippet.js
Optimised async loading of cross-domain scripts
/*
* Updated to use the function-based method described in http://www.phpied.com/social-button-bffs/
* Better handling of scripts without supplied ids.
*
* N.B. Be sure to include Google Analytics's _gaq and Facebook's fbAsyncInit prior to this function.
*/
(function(doc, script) {
var js,
fjs = doc.getElementsByTagName(script)[0],
@jonatasnona
jonatasnona / pre-commit
Created July 7, 2012 14:58 — forked from bcmiller/pre-commit
Git: pre-commit
#!/bin/sh
# Place as .git/hooks/pre-commit
#Reject any commit that would have PHP syntaz errors on .php , .module, .install, .inc files
####
# Reject any commit that would add a line with tabs.
#
# You can enable this as a repo policy with
#
# git config hooks.allowtabs true
####
@jonatasnona
jonatasnona / JS-Inheritance-5.js
Created July 25, 2012 12:52 — forked from nsisodiya/JS-Inheritance-5.js
JS-Inheritance-5.js
/* Author : Narendra Sisodiya
* Date : Thu Jul 19 18:16:38 IST 2012
* Licence : Public Code
* Purpose : Inheritance
*
*/
Function.prototype.inheritFrom = function (Base){
var F = function(){};
F.prototype = Base.prototype;
@jonatasnona
jonatasnona / frontend-templating.md
Created October 22, 2012 13:32
Front-end Templating

Front-end templating

Introduction

Using the concept of templating in the browser is becoming more and more wide-spread. Probably the main reason to this is the move of application logic from the server to the client, in tandem with the increasing usage of the MVC pattern. Templates can be extremely useful in client-side development, especially to separate markup and logic in views.

There are plenty of definitions of the term "template", here is a good one from foldoc (http://foldoc.org/template):

A document that contains parameters, identified by some special syntax, that are replaced by actual arguments by the template processing system.

@jonatasnona
jonatasnona / gist:4131215
Created November 22, 2012 13:38 — forked from mxgrn/gist:663933
Git's pre-commit hook to remove trailing whitespaces/tabs
#!/bin/sh
#
# This will abort "git commit" and remove the trailing whitespaces from the files to be committed.
# Simply repeating the last "git commit" command will do the commit then.
#
# Put this into .git/hooks/pre-commit, and chmod +x it.
if git rev-parse --verify HEAD >/dev/null 2>&1
then
against=HEAD
else
@jonatasnona
jonatasnona / pre-commit
Created November 22, 2012 13:38 — forked from mrkschan/pre-commit
a pre-commit hook for git to remove trailing whitespace
#!/bin/sh
#
# A git hook script to find and fix trailing whitespace
# in your commits. Bypass it with the --no-verify option
# to git-commit
# Ref - http://is.gd/PerowD
#
if git rev-parse --verify HEAD >/dev/null 2>&1
then
""""Create "The Matrix" of binary numbers scrolling vertically in your terminal.
original code adapted from juancarlospaco:
- http://ubuntuforums.org/showpost.php?p=10306676
Inspired by the movie: The Matrix
- Corey Goldberg (2013)
Requires:
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://npmjs.org/install.sh | sh