<!doctype html>
<html>
<head>
<title>Mittens for Kittens</title>
</head>
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
-module(buildtree). | |
-compile([export_all]). | |
tree_from_preorder(Preorder) -> | |
{T, []} = tree_from_preorder(Preorder, none), | |
T. | |
tree_from_preorder([Root | Rest], Parent = {Root}) -> | |
%% Not sure why you would want to eliminate duplicates, but ok. | |
tree_from_preorder(Rest, Parent); |
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
$ curl -v -X PUT -H 'Content-Type:application-json' -H 'Transfer-Encoding:chunked' -d @empty_file 'http://127.0.0.1:8000/empty-file' | |
* About to connect() to 127.0.0.1 port 8000 (#0) | |
* Trying 127.0.0.1... | |
* Adding handle: conn: 0x7fada300d000 | |
* Adding handle: send: 0 | |
* Adding handle: recv: 0 | |
* Curl_addHandleToPipeline: length: 1 | |
* - Conn 0 (0x7fada300d000) send_pipe: 1, recv_pipe: 0 | |
* Connected to 127.0.0.1 (127.0.0.1) port 8000 (#0) | |
> PUT /empty-file HTTP/1.1 |
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
svg { | |
stroke: none; | |
width: 500px; | |
height: 500px; | |
} | |
#logo-center { | |
position: absolute; | |
top: 80px; | |
left: 10px; |
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
/* | |
More information about transforms and transitions: | |
CSS transforms: | |
* https://developer.mozilla.org/en-US/docs/Web/CSS/transform | |
CSS transitions: | |
* https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Using_CSS_transitions |
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
userTimeline :: String -> Maybe Int -> Request | |
userTimeline name sinceId = fromJust . parseUrl $ concat | |
[ "https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=" | |
, name | |
, "&include_rts=false" | |
, maybe "" (("&since_id=" ++) . show) sinceId | |
] |
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
.clicked { | |
color: darksalmon; | |
} | |
.logo { | |
position: absolute; | |
left: 50%; | |
top: 50%; | |
width: 128px; | |
height: 128px; | |
margin-left: -64px; |
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
>>> open('chinese.csv', 'w').write(u'English\tChinese\r\nChinese\t汉语\r\n'.encode('utf-16')) | |
>>> open('chinese.csv', 'r').read() | |
'\xff\xfeE\x00n\x00g\x00l\x00i\x00s\x00h\x00\t\x00C\x00h\x00i\x00n\x00e\x00s\x00e\x00\r\x00\n\x00C\x00h\x00i\x00n\x00e\x00s\x00e\x00\t\x00Il\xed\x8b\r\x00\n\x00' | |
>>> os.system("open -a 'Microsoft Excel' chinese.csv") |
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
body { | |
background: linear-gradient(to top, green, black); | |
height: 100%; | |
background-repeat: no-repeat; | |
background-attachment: fixed; | |
margin: 0; | |
color: white; | |
} | |
h1 { | |
-webkit-user-select: none; |
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
helpers do | |
def escape(text) | |
Rack::Utils.escape_html(text) | |
end | |
def url_escape(text) | |
chunks = [] | |
after = text | |
while after != "" do | |
before, match, after = after.partition(URI.regexp) | |
if before != "" |
OlderNewer