Skip to content

Instantly share code, notes, and snippets.

@willmendesneto
willmendesneto / .functions
Last active August 29, 2015 14:15
.functions
# Simple calculator
function calc() {
local result="";
result="$(printf "scale=10;$*\n" | bc --mathlib | tr -d '\\\n')";
# └─ default (when `--mathlib` is used) is 20
#
if [[ "$result" == *.* ]]; then
# improve the output for decimal numbers
printf "$result" |
sed -e 's/^\./0./' `# add "0" for cases like ".5"` \
@willmendesneto
willmendesneto / .aliases
Created February 13, 2015 21:06
.aliases
################################################################################
# Default Aliases
################################################################################
# Easier navigation: .., ..., ...., ....., ~ and -
alias ..="cd .."
alias ...="cd ../.."
alias ....="cd ../../.."
alias .....="cd ../../../.."
@willmendesneto
willmendesneto / solarized-dark.css
Created January 4, 2015 22:13
Solarized Dark highlight for Jekyll blogs/websites
/* Solarized Dark
For use with Jekyll and Pygments
http://ethanschoonover.com/solarized
SOLARIZED HEX ROLE
--------- -------- ------------------------------------------
base03 #002b36 background
base01 #586e75 comments / secondary content
@willmendesneto
willmendesneto / gist:622aa25cf9bc6fcb81cf
Last active August 29, 2015 14:12
CLI: Funções e Alias

Algumas informações para inserirmos algumas funções e aliases no ambiente CLI. Como utilizo o oh-my-zsh, carrego alguns plugins por padrão:

plugins=(git rails ruby frontend-search nvm rvm vagrant)

É sempre uma boa prática modularizar os arquivos. Para isto criaremos 2 arquivos:

  • .functions: arquivo onde ficarão as funções;
  • .aliases: arquivo onde ficarão os atalhos/aliases;
@willmendesneto
willmendesneto / Vagrantfile
Last active August 29, 2015 14:04
Vagrantfile based in Vaprobash project
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Config Github Settings
github_username = "fideloper"
github_repo = "Vaprobash"
github_branch = "1.0.1"
github_url = "https://raw.githubusercontent.com/#{github_username}/#{github_repo}/#{github_branch}"
# Server Configuration
@willmendesneto
willmendesneto / jogos.js
Last active August 29, 2015 14:02
World Cup in six lines of Javascript based in @fmasanori jogos.py. Zepto/Jquery dependency
// Example in http://codepen.io/willmendesneto/pen/Iguor
$.get('http://worldcup.sfg.io/matches', function(data){
data.forEach(function(item){
if (item.status === 'completed') {
console.log(item.home_team.country + ' ' + item.home_team.goals + ' x ' + item.away_team.country + ' ' + item.away_team.goals);
}
});
}, 'json');
@willmendesneto
willmendesneto / Gruntfile.js
Last active August 29, 2015 14:01
Files requireds for create a project for create angular modules using Grunt task manager
'use strict';
// # Globbing
// for performance reasons we're only matching one level down:
// 'test/spec/{,*/}*.js'
// use this if you want to recursively match all subfolders:
// 'test/spec/**/*.js'
// OBS:
// Replace the string with informations
@willmendesneto
willmendesneto / print-by-divisors.js
Last active August 29, 2015 14:01
PrintByDivisors: my resolution for FizzBuzz problem
var PrintByDivisors = {
opts: {
begin: 1,
end: 100,
numbers: [15, 3, 5],
outputs: ['SouDev', 'Sou', 'Dev']
},
extend: function(target, source) {
target = target || {};
@willmendesneto
willmendesneto / Interface.js
Created March 31, 2014 18:02
Interface example in Javascript
// INTERFACE "X"
var X = {
share: function(clientEmail, email ){}
};
// LIB "A"
var A = {
type: 'facebook'
};
// LIB "B"
var B = {
@willmendesneto
willmendesneto / Gruntfile.js
Created January 9, 2014 00:22
Gruntfile template for use in projects
// Generated on 2013-10-07 using generator-angular 0.4.0
//
// OBS:
// Replace the string with informations
// '<%= yeomanConfig.assets.css %>' = Stylesheets folder
// '<%= yeomanConfig.assets.js %>' = Scripts folder
// '<%= yeomanConfig.assets.img %>' = Images folder
// '<%= yeomanConfig.assets.font %>' = Fonts folder
//
'use strict';