Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
#------------------------------------------------------------------------------ | |
# Rotinas para verificação de CPF e CNPJ | |
# Linguagem: Ruby | |
# Escrito por: André Camargo < andre@boaideia.inf.br > http://blog.boaideia.inf.br | |
# Use, copie, melhore a vontade! Patches são bem-vindos... | |
#------------------------------------------------------------------------------ | |
def check_cpf(cpf=nil) | |
return false if cpf.nil? | |
nulos = %w{12345678909 11111111111 22222222222 33333333333 44444444444 55555555555 66666666666 77777777777 88888888888 99999999999 00000000000} |
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
Version 2, December 2004 | |
Copyright (C) 2011 Mathieu 'p01' Henri - http://www.p01.org/releases/ | |
Everyone is permitted to copy and distribute verbatim or modified | |
copies of this license document, and changing it is allowed as long | |
as the name is changed. | |
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE |
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
# -*- coding: utf-8 -*- | |
def fibonacci_word(n) : | |
if n < 0 : | |
return None | |
elif n == 0 : | |
return [1] | |
elif n == 1 : | |
return [0] | |
else : |
Attention: the list was moved to
https://github.com/dypsilon/frontend-dev-bookmarks
This page is not maintained anymore, please update your bookmarks.
#' Cache the result of an expression. | |
#' | |
#' Use \code{options(cache.path = "...")} to change the cache directory (which | |
#' is the current working directory by default). | |
#' | |
#' @param expr expression to evaluate | |
#' @param key basename for cache file | |
#' @param ignore_cache evalute expression regardless of cache file? | |
#' @return result of expression or read from cache file | |
#' |
FWIW: I (@rondy) am not the creator of the content shared here, which is an excerpt from Edmond Lau's book. I simply copied and pasted it from another location and saved it as a personal note, before it gained popularity on news.ycombinator.com. Unfortunately, I cannot recall the exact origin of the original source, nor was I able to find the author's name, so I am can't provide the appropriate credits.
#!/usr/bin/env bash | |
set -Eeuo pipefail | |
trap cleanup SIGINT SIGTERM ERR EXIT | |
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P) | |
usage() { | |
cat <<EOF | |
Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...] |