Skip to content

Instantly share code, notes, and snippets.

Carlos Souza caike

Block or report user

Report or block caike

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:362203
from unittest import TestCase, main
import re
class WordList(object):
def __init__(self, unsorted_words):
self.unsorted_words = unsorted_words
def unsorted(self):
return self.unsorted_words
View gist:374354
## shared connections from profile search result
profile.relation_to_viewer["relation-to-viewer"].
gsub(/\n/,'').
scan(/(\s[a-zA-Z]+\s+[a-zA-Z]+)/).each do |n|
p n.to_s.strip.gsub(/\s+/, ' ')
end
View installing ruby-1.8.6-p111
Ruby 1.9.0.0 compile error (openssl problem)
TAGS: None
Found these error:
view sourceprint?
compiling openssl
gcc -I. -I../../.ext/include/i686-darwin10.2.0 -I../.././include -I../.././ext/openssl -DRUBY_EXTCONF_H=\"extconf.h\" -fno-common -g -O2 -pipe -fno-common -o openssl_missing.o -c openssl_missing.c
In file included from openssl_missing.c:22:
View meu prompt
export PS1='[\W `~/.rvm/bin/rvm-prompt v p g ` `git branch 2> /dev/null | grep -e ^* | sed -E s/^\\\\\*\ \(.+\)$/\[\033[1\;32m\]\(\\\\\1\)\/`\[\033[37m\]]$\[\033[00m\] '
View mysql ruby gem on Leopard
env ARCHFLAGS="-arch i386" gem install mysql -- \
--with-mysql-dir=/usr/local/mysql --with-mysql-lib=/usr/local/mysql/lib \
--with-mysql-include=/usr/local/mysql/include
View start mysql on startup
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>com.mysql.mysqld</string>
<key>ProgramArguments</key>
<array>
View prompt (git, rvm)
export PS1='[\W `~/.rvm/bin/rvm-prompt v p g ` `git branch 2> /dev/null | grep -e ^* | sed -E s/^\\\\\*\ \(.+\)$/\[\033[1\;32m\]\(\\\\\1\)\/`\[\033[37m\]]$\[\033[00m\] '
View main.rb
class NotANumberException < StandardError
end
class FizzBuzz
def initialize(numero)
raise NotANumberException unless numero.is_a? Integer
@numero = numero
end
View prs_spec.js
function round(a, b) {
if (arguments.length != 2){
return "fail";
}
var matrix = {
paper:{winsAgainst:"rock"},
rock:{winsAgainst:"scissors"},
scissors:{winsAgainst:"paper"}
}
@caike
caike / gist:733989
Created Dec 8, 2010
last.fm's current song
View gist:733989
url = "http://ws.audioscrobbler.com/2.0/?method=user.getrecenttracks&user=mofouser&api_key=mofoapikey"
resp = HTTParty::get(url)
p resp.parsed_response["lfm"]["recenttracks"]["track"].first {|t| t["nowplaying"] == "true" }
You can’t perform that action at this time.