Skip to content

Instantly share code, notes, and snippets.

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
## 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
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:
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\] '
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
<?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>
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\] '
class NotANumberException < StandardError
end
class FizzBuzz
def initialize(numero)
raise NotANumberException unless numero.is_a? Integer
@numero = numero
end
@caike
caike / prs_spec.js
Created October 25, 2010 14:07
prs.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 December 8, 2010 21:56
last.fm's current song
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" }