Skip to content

Instantly share code, notes, and snippets.

View fakenickels's full-sized avatar
💭
hello this is a mic test, are you listening

Gabriel Rubens Abreu fakenickels

💭
hello this is a mic test, are you listening
View GitHub Profile
@fakenickels
fakenickels / command.sh
Created October 20, 2015 13:07
Jenkins shell script to test Meteor packages
if [ ! -d "spacejam" ]; then
git clone https://github.com/practicalmeteor/spacejam.git --depth=1
fi
cd spacejam/
npm link
cd ../
spacejam test-packages ./
@fakenickels
fakenickels / simple_animation_engine.js
Last active December 19, 2015 10:29
Simple JavaScript Animation Engine
function now(){
return ( new Date ).getTime();
}
function animate( time, fn, fps ){
var start = now(),
intrval = fps ? 1000/fps : 20,
id = setInterval(function(){
var diff = now() - start, p = diff/time;
@fakenickels
fakenickels / frequently_words.sh
Created October 5, 2013 21:08
A simple shell script that shows and enumerates the most frequently words used in a file
# Show and enumerate the most frequently words in a file
# Use:
# $ chmod a+x frequently_words.sh
# $ ./frequently_words file_path
cat $1 | tr -cs A-Za-z '\n' | tr A-Z a-z | sort | uniq -c | sort -rn
@fakenickels
fakenickels / frequently_words.js
Last active December 25, 2015 01:09
The same algorithm of frequently_words.sh in JavaScript
function analyse( text ){
var words = {},
text = text.toLowerCase()
.replace(/[.,]+/g, '')
.replace(/[^\w\s\t\n]+/, '')
.split(' ');
for( var i in text ){
if( words[ text[i] ] == undefined )
words[ text[i] ] = 1;
@fakenickels
fakenickels / ytdownload.js
Created October 21, 2013 23:48
Just put this script to execute on a YouTube video page, and download it!
!function( ytplayer ){
var url = ytplayer.config.args["url_encoded_fmt_stream_map"],
videoFormats = url.split(','),
videos = [],
props = ['quality', 'type'];
setFormats();
askToUser();
{
"estados": [
{
"sigla": "AC",
"nome": "Acre",
"cidades": [
"Acrelândia",
"Assis Brasil",
"Brasiléia",
"Bujari",
@fakenickels
fakenickels / simpleED.js
Created December 5, 2013 03:22
Simple Encrypt-Decrypt Algorithm
var key = 'heuehueheubrbrbrprasswithlasers333';
/*
* Simple Encrypt-Decrypt Algorithm
* mode = 1 or -1
* 1 -> Encrypt mode
* -1 -> Decrypt mode
*/
function simpleED( str, mode ){
@fakenickels
fakenickels / frequently_words.rb
Created January 17, 2014 05:39
Frequently used words scanner in Ruby
module Analiser
extend self
def parse(text)
originalArray = text.split(/\s/).reject {|x| x.empty?}
repeatedWords = {}
originalArray.each do |word|
word.downcase!
if repeatedWords.has_key?(word.to_sym)
@fakenickels
fakenickels / .zshrc
Created January 4, 2016 16:24
My dots
export ZSH=/home/gabriel/.oh-my-zsh
ZSH_THEME="bureau"
plugins=(git bower common-aliases meteor npm node nyan sudo wd)
# User configuration
alias gfd="g flow feature diff"
export PATH="/home/gabriel/.nvm/versions/node/v4.0.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
# export MANPATH="/usr/local/man:$MANPATH"
@fakenickels
fakenickels / concise_methods.sh
Last active January 19, 2016 22:59
ES5 to ES6 syntax snippets
# { fn:function(args){} } => { fn(args){} }
find . -name \*.js -exec perl -p -i -e 's/:\s?function\s?\((.+)?\)\s?/(\1)/' {} \;