Skip to content

Instantly share code, notes, and snippets.

View tonyseek's full-sized avatar

Jiangge Zhang tonyseek

View GitHub Profile
@tonyseek
tonyseek / MainActivity.scala
Created September 13, 2012 10:13
Writing android demo application with Scala
package com.tonyseek.droid
import android.app.ActionBar
import android.app.FragmentTransaction
import android.os.Bundle
import android.support.v4.app.Fragment
import android.support.v4.app.FragmentActivity
import android.support.v4.app.FragmentManager
import android.support.v4.app.FragmentPagerAdapter
import android.support.v4.view.ViewPager
@tonyseek
tonyseek / gateway.py
Created September 18, 2012 04:55
A utility to give a object a gateway to exchange data with outside sources.
#!/usr/bin/env python
#-*- coding:utf-8 -*-
import re
import copy
import logging
from db.sqlstore import store
@tonyseek
tonyseek / gitconfig
Last active October 12, 2015 10:28
[DEPRECATED] My Git Configuration
[user]
name = Jiangge Zhang
email = tonyseek@gmail.com
[color]
ui = auto
[alias]
lg = log --color --graph --pretty=format:'%Cred%h%Creset - %C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --
ci = commit
st = status
br = branch
@tonyseek
tonyseek / Usage.markdown
Created November 28, 2012 12:46
Visualizing Gcc's AST
@tonyseek
tonyseek / nginx_site
Last active December 10, 2015 07:58
A script to manage nginx sites.
#!/usr/bin/env sh
SITES_AVAILABLE_DIR="/etc/nginx/sites-available"
SITES_ENABLED="/etc/nginx/sites-enabled"
case "$1" in
enable)
if [ -f "${SITES_AVAILABLE_DIR}/$2" ]
then
ln -s "${SITES_AVAILABLE_DIR}/$2" "${SITES_ENABLED}/$2"
@tonyseek
tonyseek / login-szu-ipv6.py
Last active December 14, 2015 17:49
The network setup script for Shenzhen University.
#!/usr/bin/env python
#-*- coding:utf-8 -*-
"""The login CLI for Shenzhen University IPv6.
"""
import argparse
import urllib
import getpass
import sys
#!/usr/bin/env python
#-*- coding:utf-8 -*-
import uuid
def entity_repr(entity, attrs):
"""Dumps attributes and values of given entity object."""
attrs_repr = (u"%s=%s" % (n, repr(getattr(entity, n))) for n in attrs)
unicode_repr = u"%s(%s)" % (type(entity).__name__, u", ".join(attrs_repr))

"Why You Don't Get Mock Objects" by Gregory Moeck

RubyConf 2011 | 2011-09-29 | Gregory Moeck (@gregmoeck) | Slides

  • Recommended as the best book on mocks: Growing Object-Oriented Software, Guided by Tests by Steve Freeman & Nat Pryce
  • Common arguments against mocks
    • They duplicate implementation
    • They lead to brittle tests
  • Mock objects + procedural programming = bad idea
  • If you're doing traditional Rails development (which tends to follow more of a "procedural", do-this-and-then-do-that style), mock objects probably aren't for you
@tonyseek
tonyseek / octopress-send-to-kindle.diff
Created May 30, 2013 02:49
Show a button to send post to kindle on the posts of Octopress.
diff --git a/_config.yml b/_config.yml
index 42de00c..24dff5e 100644
--- a/_config.yml
+++ b/_config.yml
@@ -72,6 +72,9 @@ github_repo_count: 3
github_show_profile_link: true
github_skip_forks: true
+# Send to Kindle
+send_to_kindle_button: true