This file contains 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
from struct import unpack | |
class Palette: | |
color_length = 3 | |
def __init__(self, fp): | |
self.palette = [] | |
for i in range(256): | |
color = fp.read(self.color_length) |
This file contains 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
#!/usr/bin/env coffee | |
sys: require 'sys' | |
http: require 'http' | |
server: http.createServer (req, res) -> | |
res.writeHeader 200, {'Content-Type': 'text/plain'} | |
res.write 'Hello, World!' | |
res.end() |
This file contains 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
function parse_git_dirty { | |
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*" | |
} | |
export PS1='\[\033[1;38m\]\u\[\033[1;32m\] `~/bin/rvm-prompt i v g`\[\033[1;31m\] \W\[\033[1;33m\]`\ | |
git branch 2> /dev/null | grep -e ^* | sed -E s/^\\\\\*\ \(.+\)$/[\\\\\1$(parse_git_dirty)]\/` \[\033[37m\]$\[\033[00m\] ' |
This file contains 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 should_behave_like_resource(opts = {}) | |
before :each do | |
@opts = opts | |
end | |
def class_for(str) | |
str.capitalize.constantize | |
end | |
def clazz |
This file contains 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
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii"> | |
<script type="text/javascript" src="http://assets.vitrine.abril.com.br/js?c=abrilcomtry_blogs"></script> | |
</head> | |
<body> | |
<style> | |
#vitbox { | |
float: left; |
This file contains 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
>>> type(1) | |
<type 'int'> | |
>>> type(2.5) | |
<type 'float'> | |
>>> type("foobar") | |
<type 'str'> | |
>>> variavel = 1 | |
>>> type(variavel) | |
<type 'int'> | |
>>> variavel = 2.5 |
This file contains 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
... | |
if (condition) { | |
service.doSomething(arg1, arg2, arg3, arg4, arg5, arg6, ... , arg100, true); | |
} else { | |
service.doSomething(arg1, arg2, arg3, arg4, arg5, arg6, ... , arg100, false); | |
} | |
... |
This file contains 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
#!/usr/bin/env python | |
import SocketServer | |
from os.path import getsize | |
from mimetypes import read_mime_types | |
from datetime import date | |
# Mon, 27 Jul 2009 12:28:53 GMT | |
template = """HTTP/1.1 200 OK |
This file contains 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
/** | |
* Space invaders generator. Generates and draws invaders. Inspired | |
* by invaders fractals: | |
* http://www.levitated.net/daily/levInvaderFractal.html | |
* | |
* Mouse press will create new invaders and draw the new ones. | |
*/ | |
/** Scaling factor */ | |
float sc = 3f; |
This file contains 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 urllib2 | |
print urllib2.urlopen("http://www.google.cl").read() |
OlderNewer