Skip to content

Instantly share code, notes, and snippets.

View dm4's full-sized avatar
4️⃣

dm4 dm4

4️⃣
View GitHub Profile
@dm4
dm4 / python_resources.md
Last active August 29, 2015 14:10 — forked from jookyboi/python_resources.md
Python-related modules and guides.

Packages

  • lxml - Pythonic binding for the C libraries libxml2 and libxslt.
  • boto - Python interface to Amazon Web Services
  • Django - Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.
  • Fabric - Library and command-line tool for streamlining the use of SSH for application deployment or systems administration task.
  • PyMongo - Tools for working with MongoDB, and is the recommended way to work with MongoDB from Python.
  • Celery - Task queue to distribute work across threads or machines.
  • pytz - pytz brings the Olson tz database into Python. This library allows accurate and cross platform timezone calculations using Python 2.4 or higher.

Guides

@dm4
dm4 / javascript_resources.md
Last active August 29, 2015 14:10 — forked from jookyboi/javascript_resources.md
Here are a set of libraries, plugins and guides which may be useful to your Javascript coding.

Libraries

  • jQuery - The de-facto library for the modern age. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.
  • Backbone - Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
  • AngularJS - Conventions based MVC framework for HTML5 apps.
  • Underscore - Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects.
  • lawnchair - Key/value store adapter for indexdb, localStorage
@dm4
dm4 / 0_reuse_code.js
Last active August 29, 2015 14:10
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
#!/bin/bash
# Script for installing tmux on systems where you don't have root access.
# tmux will be installed in $HOME/local/bin.
# It's assumed that wget and a C/C++ compiler are installed.
# exit on error
set -e
TMUX_VERSION=1.8
@dm4
dm4 / private.xml
Created January 29, 2014 16:14
Leaf RSS Reader j / k key binding using KeyRemap4Macbook
<?xml version="1.0"?>
<root>
<appdef>
<appname>Leaf</appname>
<equal>com.rockysandstudio.Leaf</equal>
</appdef>
<item>
<name>dm4</name>
<item>
<name>Leaf j/k key binding</name>
# A handy j() function, printing some useful info in bash cmdline
j() {
printf '\n\e[0;35m%(%Y/%m/%d (%a) %H:%M:%S)T\e[0m ' -1
printf '\n\e[0;33m%s@%s\e[0m ' "$USER" "${HOSTNAME/.*/}"
if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
local GIT_CLEAN=
local GIT_REF=$(git rev-parse --abbrev-ref HEAD 2>/dev/null)
git diff-index --quiet HEAD && GIT_CLEAN=1
@dm4
dm4 / double.c
Created July 24, 2013 18:04
原來 double 是指標啊
#include <stdio.h>
int main(int argc, const char *argv[]) {
double d = 12.34;
printf("d 0x%016x\n", d);
printf("&d 0x%016x\n", &d);
printf("*(long long *)&d 0x%016lx\n", *(long long *)&d);
return 0;
}
# Usage: pr (pull request current branch into develop)
# Usage 2: pr stable (pull request current branch into stable)
function pr() {
base=$1;
if [ "$1" == "" ]; then
base="develop"
fi
hub pull-request -b team:"$base" -h team:`git rev-parse --abbrev-ref HEAD`;
}
@dm4
dm4 / Macros.h
Created February 26, 2013 09:01 — forked from numo16/Macros.h
#define ApplicationDelegate ((AppDelegate *)[[UIApplication sharedApplication] delegate])
#define UserDefaults [NSUserDefaults standardUserDefaults]
#define NotificationCenter [NSNotificationCenter defaultCenter]
#define SharedApplication [UIApplication sharedApplication]
#define Bundle [NSBundle mainBundle]
#define MainScreen [UIScreen mainScreen]
#define ShowNetworkActivityIndicator() [UIApplication sharedApplication].networkActivityIndicatorVisible = YES
#define HideNetworkActivityIndicator() [UIApplication sharedApplication].networkActivityIndicatorVisible = NO
#define NetworkActivityIndicatorVisible(x) [UIApplication sharedApplication].networkActivityIndicatorVisible = x
#define NavBar self.navigationController.navigationBar
invoke-virtual v0, v1, v5, Landroid/content/Intent;->putExtra(Ljava/lang/String; Ljava/lang/String;)Landroid/content/Intent;
v0
invoke-virtual v0, v1, v2, Landroid/content/Intent;->putExtra(Ljava/lang/String; Landroid/os/Parcelable;)Landroid/content/Intent;
v0
invoke-virtual v0, v1, Landroid/content/Intent;->setPackage(Ljava/lang/String;)Landroid/content/Intent;
v0
invoke-direct v0, v1, Landroid/content/Intent;-><init>(Ljava/lang/String;)V
v0
new-instance v0, Landroid/content/Intent;
v1