Skip to content

Instantly share code, notes, and snippets.

@calimaborges
calimaborges / combinatorial-analysis.js
Last active December 1, 2021 10:56
Array combinations, permutations and arrangements
// permutation: Permutação
// P(n) = n!
// Exemplo: número de anagramas da palavra LIVRO = P(5) = n!
// Possibilidades de uma fila de 25 pessoas = P(25) = 25!
// combination: Combinação
// C(p,n) = = n! / p!(n - p)!
// Exemplo: formar comissão de 3 pessoas escolhidas entre 10 pessoas. C(3,10) = 10! / 3!(10 - 3)!
// arrangement: Arranjo
@calimaborges
calimaborges / cocoonjs-extended-facebook.js
Created August 27, 2014 05:08
Cocoon Facebook Work In Progress
if (!(typeof window.CocoonJS === 'undefined' || window.CocoonJS === null)) { // BEGIN - CHECK FOR COCOONJS
(function() {
// The CocoonJS and CocoonJS.Social must exist before creating the extension.
if (typeof window.CocoonJS === 'undefined' || window.CocoonJS === null) throw("The CocoonJS object must exist and be valid before creating the extension types.");
if (typeof window.CocoonJS.Social === 'undefined' || window.CocoonJS.Social === null) throw("The CocoonJS.Social object must exist and be valid before creating the extension types.");
/**
* @class
* @constructor
* Represents a type that mimics the original Facebook API with the addition of the possibility to
alias __git_ps1="git branch 2>/dev/null | grep '*' | sed 's/* \(.*\)/(\1)/'"
export CLICOLOR=1
#export LSCOLORS=gxBxhxDxfxhxhxhxhxcxcx
export LSCOLORS=ExFxCxDxBxegedabagacad
RESET="\[\017\]"
NORMAL="\[\033[0m\]"
USER_COLOR="\[\033[1;32m\]"
DIR_COLOR="\[\033[1;35m\]"
GIT_COLOR="\[\033[1;33m\]"
@calimaborges
calimaborges / readme.md
Last active March 9, 2016 04:46
PHP + Laravel + Mac Configurations

PHP

Diretório onde será instalado: /usr/local/php5-*

Referência: http://php-osx.liip.ch/

Comando:

curl -s http://php-osx.liip.ch/install.sh | bash -s 5.6
@calimaborges
calimaborges / readme.md
Created March 10, 2016 16:10
Steps to create new project
  • Create GitHub repo (tell it to create the README.md and the .gitignore to proper language)
  • Clone de repo in your development environment
  • npm init the repo
  • Commit the repo
  • Integrate Travis CI
  • Integrate Code Climate
  • Add Code Coverage from Code Climate
  • Update README.md with badges
@calimaborges
calimaborges / readme.md
Last active September 5, 2024 20:37
Curl Examples

curl examples

Usefull for REST

GET

curl -i -H "Accept: application/json" http://192.168.0.165/persons/person/1  
@calimaborges
calimaborges / versao1.java
Last active July 4, 2016 17:20
IoC and Factory
class TarefaRepository {
public List<Tarefa> listaTarefas() {
return new ArrayList<Tarefa>() {{
add(new Tarefa("titulo 1", "descricao 1"))
add(new Tarefa("titulo 2", "descricao 2"))
}};
}
}
@calimaborges
calimaborges / .editorconfig
Last active July 16, 2016 02:23
workflow-back-end-java-parte1-hello-world-spark
# http://editorconfig.org
root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
max_line_length = 80
@calimaborges
calimaborges / .gitignore
Created July 15, 2016 22:40
workflow-back-end-java-parte2-versionando-com-git-github
.idea
*.iml
target