Skip to content

Instantly share code, notes, and snippets.

View douglarek's full-sized avatar

douglarek

View GitHub Profile
find . -name "*.html" -or -name "*.py" |xargs grep -v "^\$"|wc -l
@douglarek
douglarek / index.html
Created June 4, 2014 13:01
Jump from one to another page
<html>
<head>
<meta http-equiv="refresh" content="0;url=/bbs/index.php">
</head>
<body></body>
</html>
Git
Package Control
pep8 lint
SublimeCodeIntel
VimL

Asynchronous programming with Tornado

Asynchronous programming can be tricky for beginners, therefore I think it's useful to iron some basic concepts to avoid common pitfalls.

For an explanation about generic asynchronous programming, I recommend you one of the [many][2] [resources][3] [online][4].

I will focus on solely on asynchronous programming in [Tornado][1]. From Tornado's homepage:

# Alternatively don't use slog but something else. I just like that more.
[aliases]
slog = log --pretty=format:"%C(auto,yellow)%h%C(auto)%d\\ %C(auto,reset)%s\\ \\ [%C(auto,blue)%cn%C(auto,reset),\\ %C(auto,cyan)%ar%C(auto,reset)]"
addprx = "!f() { b=`git symbolic-ref -q --short HEAD` && \
git fetch origin pull/$1/head:pr/$1 && \
git fetch -f origin pull/$1/merge:PR_MERGE_HEAD && \
git rebase --onto $b PR_MERGE_HEAD^ pr/$1 && \
git branch -D PR_MERGE_HEAD && \
git checkout $b && echo && \
git diff --stat $b..pr/$1 && echo && \
/* Global Styles */
/* ------------------------------- */
body {
padding-top: 100px;
background-color: #f8f8f8;
}
@media(min-width:768px) {
defaults write -app Kindle AppleLanguages -array zh-Hans
/* Hello World */
package main
import (
"flag"
"os"
)
var omitNewline = flag.Bool("n", false, "don't print final newline")
#!/bin/sh
java -cp $HOME/bin/clojure-1.6.0.jar clojure.main $@
(def visitors (atom #{}))
(defn hello
"Writes hello message to *out*. Calls you by username.
Knows if you have been here before."
[username]
(swap! visitors conj username)
(str "Hello, " username))