This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TelephoneDecoder | |
Codes = {'abc'=>2, | |
'def'=>3, | |
'ghi'=>4, | |
'jkl'=>5, | |
'mno'=>6, | |
'pqrs'=>7, | |
'tuv'=>8, | |
'wxyz'=>9} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def fibonacci(num): | |
def _fib(n, p0=0, p1=1): | |
if n == 0: | |
return p1 | |
return _fib(n - 1, p1, p0 + p1) | |
return _fib(num) | |
# another way, without external function | |
def fib(num, p0=0, p1=1): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import timeit | |
SETUP = """ | |
def fib(n, p0=0, p1=1): | |
if n == 0: | |
return p1 | |
return fib(n-1, p1, p0+p1) | |
""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
site: cd site && rails s | |
admin: cd admin && rails s -p 3001 | |
assets: cd assets && rackup | |
public: cd sites/vulgo/public && python -m SimpleHTTPServer 8081 | |
memcached: memcached |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source :rubygems | |
gem 'sinatra' | |
gem 'haml' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source :rubygems | |
gem 'sinatra' | |
gem 'haml' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// line 1 "Lexer.rl" | |
public class Lexer { | |
// line 19 "Lexer.rl" | |
// line 10 "Lexer.java" | |
private static byte[] init__simple_lexer_actions_0() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Usuario < ActiveRecord::Base | |
# Include default devise modules. Others available are: | |
# :token_authenticatable, :confirmable, | |
# :lockable, :timeoutable and :omniauthable | |
devise :database_authenticatable, :registerable, | |
:recoverable, :rememberable, :trackable, :validatable | |
# Setup accessible (or protected) attributes for your model | |
attr_accessible :nome, :email, :password, :password_confirmation, :remember_me | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package caixa_eletronico | |
// Solucao do problema do caixa eletronico | |
// http://dojopuzzles.com/problemas/exibe/caixa-eletronico/ | |
func Saque(valor int) (resultado []int) { | |
cedulas := [7]int{100, 50, 20, 10, 5, 2, 1} | |
for _, cedula := range cedulas { | |
for valor >= cedula { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
#include<stdlib.h> | |
#include<string.h> | |
#define TAM_CADEIA 51 | |
#define DNA 'D' | |
#define RNA 'R' | |
int validarCadeia(char cadeia[], char opcao); | |
void menu_DNA(char cadeia[]); |
OlderNewer