Skip to content

Instantly share code, notes, and snippets.

View timdream's full-sized avatar
🏃‍♂️
I may be slow to respond.

Timothy Guan-tin Chien timdream

🏃‍♂️
I may be slow to respond.
View GitHub Profile
<!DOCTYPE html>
<html manifest="manifest.appcache">
<head>
<meta charset="utf-8">
<meta http-equiv="pragma" content="no-cache">
<!-- System -->
<script>
</script>
</head>
/* Contact Manager for maintaining contact cache and access contact db.
* 1. Maintain used contacts in contactData object literal.
* 2. getContactData: Call the callback with contact data.
* Callback will be called twice if cached data turned out to be different than
* the data from db.
*/
var ContactDataManager = {
contactData: {},
getContactData: function cm_getContactData(options, callback) {
var isCacheable = (options.filterBy.indexOf('tel') !== -1 &&
@timdream
timdream / index.html
Created May 28, 2012 03:59
Key event test
<!DOCTYPE html>
<html manifest="manifest.appcache">
<body>
Tap on the black space to test key events bubbling from mozbrowser.
Tap on the red space to test key events bubbling from mozbrowser within mozbrowser.
<iframe width=400 height=600 mozbrowser src="data:text/html,<body bgcolor=black>&lt;iframe mozbrowser src='data:text/html,<body bgcolor=red>'>&lt;/iframe></body>"></iframe>
<script>
['keydown', 'keypress', 'keyup'].forEach(function (type) {
window.addEventListener(type, function (evt) {
@timdream
timdream / .git_config
Created April 25, 2012 03:01
git-svn conversion for moztw-web
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[svn-remote "svn"]
url = http://svn.openfoundry.org/moztw
fetch = :refs/remotes/git-svn
[svn]
authorsfile = /home/timdream/repo/moztw/authors.txt
@timdream
timdream / pullme.php
Last active October 2, 2015 21:38
Minimuist pull me script that work with Github hook
<?php
/* host machine settings */
$GIT_BIN = '/usr/local/bin/git';
$LOCAL_USER = 'www';
/* remote repo settings */
$REMOTE = 'origin';
$BRANCH = 'production';
@timdream
timdream / VBoxReloadKext.sh
Created February 10, 2012 07:33
reload VirtualBox kernel extension in Mac OS X - good for USB problem on Lino
#!/bin/bash
sudo kextunload -b org.virtualbox.kext.VBoxUSB
sudo kextunload -b org.virtualbox.kext.VBoxNetFlt
sudo kextunload -b org.virtualbox.kext.VBoxNetAdp
sudo kextunload -b org.virtualbox.kext.VBoxDrv
sudo kextload /Library/Extensions/VBoxDrv.kext -r /Library/Extensions/
sudo kextload /Library/Extensions/VBoxNetFlt.kext -r /Library/Extensions/
sudo kextload /Library/Extensions/VBoxNetAdp.kext -r /Library/Extensions/
@timdream
timdream / test.sh
Created January 4, 2012 02:37
rebase fail
#!/bin/sh
cd /tmp
# init remote
mkdir remote.git
cd remote.git
git init --bare
/*!
*
* Imgur CORS Image upload
*
* Author & Copyright: timdream (timdream@gmail.com; http://timdream.org/)
* License: MIT LICENSE
*
*/
"use strict";
@timdream
timdream / func.php
Created April 11, 2011 09:04
Get COSCUP sponsor list from GData table
<?php
/*
getSponsorListFromRemote($key)
@param: key = key of google spreadsheet doc
@return:
false on failure
array when success
@timdream
timdream / sessions.js
Created March 30, 2011 16:23
議程 JSON
[
{
name: '測是',
from: 1234456788, /* Unix timestamp */
to: 123456778,
type: 1,
room: 0,
language: 'zh', /* 'zh' or 'en', 我們應該不會有日文議程 */
speaker: '陳愛講', /* 名字 (頭銜)*/
speakerTitle: '測試大學愛講系教授',