Skip to content

Instantly share code, notes, and snippets.

@heronmedeiros
heronmedeiros / raskell.rb
Created August 19, 2012 02:52 — forked from andkerosine/raskell.rb
Haskell-like list comprehensions in Ruby
$stack, $draws = [], {}
def method_missing *args
return if args[0][/^to_/]
$stack << args.map { |a| a or $stack.pop }
$draws[$stack.pop(2)[0][0]] = args[1] if args[0] == :<
end
class Array
def +@
@heronmedeiros
heronmedeiros / .vimrc
Created August 14, 2012 14:19
vimrc ubuntu
source /home/heron/.vim/vimrc
"Shortcut to rapidly toggle `set list`
nmap <leader>l :set list!<CR>
"Map \s as show git status
nmap <leader>s :Gstatus<CR>
" Use the same symbols as TextMate for tabstops and EOLs
set listchars=tab:▸\ ,eol:¬,trail:-
@heronmedeiros
heronmedeiros / apple-search.css
Created August 14, 2012 03:20
input search like apple
form {
}
form input[type="text"] {
background: url(images/search.png) no-repeat 10px 6px #fcfcfc;
border: 1px solid #d1d1d1;
font: bold 12px Arial,Helvetica,Sans-serif;
color: #bebebe;
width: 150px;
# MySQL. Versions 4.1 and 5.0 are recommended.
#
# Install the MySQL driver:
# gem install mysql2
#
# And be sure to use new-style password hashing:
# http://dev.mysql.com/doc/refman/5.0/en/old-client.html
development:
adapter: mysql2
encoding: utf8
@heronmedeiros
heronmedeiros / calback.js
Created August 26, 2011 19:12
Exemplo de callback em JS
function doSomething(callback) {
// faca algo de util
// chama o callback
callback('coisas', 'aqui');
}
function funcaoComCallback(a, b) {
// callback
alert(a + " " + b);
@heronmedeiros
heronmedeiros / ListaAlunos.java
Created August 6, 2011 03:03
exemplo caelum
import java.util.Arrays;
import java.util.List;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListView;
@heronmedeiros
heronmedeiros / .vimrc
Created August 1, 2011 19:03 — forked from henriquegogo/.vimrc
Meu arquivo de configuração .vimrc do Vim
""""""""""""""""""""""""""""""""""""""""
" CONFIGURAÇÕES GOGS - WWW.GOGS.COM.BR "
""""""""""""""""""""""""""""""""""""""""
set number " Numera as linhas
set linebreak " Quebra a linha sem quebrar a palavra
set nobackup " Não salva arquivos de backup~
set wildmode=longest,list " Completa o comando com TAB igual o bash
set ignorecase " Ignora o case sensitive nas buscas
set smartcase " Se tiver alguma letra maiúscula, ativa o case sensitive
set gdefault " Sempre substitui todas as palavras, não só a primeira
-module(day1).
-export([count_words/1]).
-export([upto/1]).
-export([printRet/1]).
% 1. Write a function that uses recursion to count the number of words in a string
list_len([]) -> 0;
list_len(Input) ->
[H | Tail] = Input,
@heronmedeiros
heronmedeiros / mysql_rails.sh
Created July 20, 2011 19:44
Rodar rails com mysql direto
#!/bin/bash
if [ -z "$1" ] ; then
echo "Coloque o nome da app"
else
a="rails new $1 -d mysql"
echo $a
exec $a
@heronmedeiros
heronmedeiros / gist:1045980
Created June 25, 2011 01:07
Slidr's test - mongoose
module.exports['Mongoose: attendees'] = testCase({
"Mongoose must have model Atteendee" : function(test){
test.ok(mongoose.models.hasOwnProperty('attendees'));
test.done();
},
"mongoose.attendees must be a function" : function(assert){
var value = mongoose.models.attendees;
assert.ok(typeof(value), "function" );
assert.done();