Skip to content

Instantly share code, notes, and snippets.

View chuanxd's full-sized avatar

Timmy Chang chuanxd

View GitHub Profile
@chuanxd
chuanxd / Client.java
Created April 27, 2013 08:36
Java basic client server linking program on command line. Server [port_number] Client [ip_address] [port_number]
import java.io.*;
import java.net.*;
public class Client {
int i;
static String iaddr;
static int port;
public Client() {
try{
@chuanxd
chuanxd / hello.js
Created May 22, 2013 07:23
node.js Hello World
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello Node.js\n');
}).listen(8124, "127.0.0.1");
console.log('Server running at http://127.0.0.1:8124/');
@chuanxd
chuanxd / japanese.txt
Created April 1, 2016 16:19
五十音
"あ(a)" "か(ka)" "さ(sa)" "た(ta)" "な(na)" "は(ha)" "ま(ma)" "や(ya)" "ら(ra)" "わ(wa)" "い(i)" "き(ki)" "し(shi)" "ち(chi)" "に(ni)" "ひ(hi)" "み(mi)" "り(ri)" "う(u)" "く(ku)" "す(su)" "つ(tsu)" "ぬ(nu)" "ふ(fu)" "む(mu)" "ゆ(yu)" "る(ru)" "ん(n )" "え(e)" "け(ke)" "せ(se)" "て(te)" "ね(ne)" "へ(he)" "め(me)" "れ(re)" "お(o)" "こ(ko)" "そ(so)" "と(to)" "の(no)" "ほ(ho)" "も(mo)" "よ(yo)" "ろ(ro)" "を(o)" "が(ga)" "ざ(za)" "だ(da)" "ば(ba)" "ぱ(pa)" "ぎ(gi)" "じ(ji)" "ぢ(ji)" "び(bi)" "ぴ(pi)" "ぐ(gu)" "ず(zu)" "づ(zu)" "ぶ(u)" "ぷ(pu)" "げ(ge)" "ぜ(ze)" "で(de)" "べ(be)" "ぺ(pe)" "ご(go)" "ぞ(zo)" "ど(do)" "ぼ(bo)" "ぽ(po)" "きゃ(kya)" "ぎゃ(gya)" "しゃ(sha)" "じゃ(ja)" "ちゃ(cha)" "にゃ(nya)" "ひゃ(hya)" "びゃ(bya)" "ぴゃ(pya)" "みゃ(mya)" "りゃ(rya)" "きゅ(kyu)" "ぎゅ(gyu)" "しゅ(shu)" "じゅ(ju)" "ちゅ(chu)" "にゅ(nyu)" "ひゅ(hyu)" "びゅ(byu)" "ぴゅ(pyu)" "みゅ(myu)" "りゅ(ryu)" "きょ(kyo)" "ぎょ(gyo)" "しょ(sho)" "じょ(jo)" "ちょ(cho)" "にょ(nyo)" "ひょ(hyo)" "びょ(byo)" "ぴょ(pyo)" "みょ(myo)" "りょ(ryo)" "ア(a)" "カ(ka)" "サ(sa)" "タ(ta)" "ナ(na)" "ハ(ha)" "マ(ma)" "ヤ(ya)" "ラ(ra)" "ワ(wa)" "イ(i)" "キ(ki)" "シ(shi)" "チ(chi)" "ニ(ni)" "ヒ(hi)" "ミ(mi
@chuanxd
chuanxd / curl_example.php
Created May 14, 2016 03:40 — forked from carbontwelve/curl_example.php
PHP Curl to check if url is alive
<?php
function check_alive($url, $timeout = 10, $successOn = array(200, 301)) {
$ch = curl_init($url);
// Set request options
curl_setopt_array($ch, array(
CURLOPT_FOLLOWLOCATION => false,
CURLOPT_NOBODY => true,
CURLOPT_TIMEOUT => $timeout,
@chuanxd
chuanxd / gist:60202f7342245f83d942533eb30ed7ab
Created June 1, 2016 10:49 — forked from ihower/gist:6132576
Git commit without commit
# First commit
echo "hello" | git hash-object -w --stdin
git update-index --add --cacheinfo 100644 ce013625030ba8dba906f756967f9e9ca394464a hello.txt
git write-tree
git commit-tree aaa96c -m "First commit"
git update-ref refs/heads/master 30b060d9a7b5e93c158642b2b6f64b2b758da40d
# Second commit
@chuanxd
chuanxd / vscode-window-keybindings.json
Last active March 9, 2017 09:18
Switch key cmd & ctrl
[
{ "key": "cmd+1", "command": "workbench.action.openEditorAtIndex1" },
{ "key": "cmd+2", "command": "workbench.action.openEditorAtIndex2" },
{ "key": "cmd+3", "command": "workbench.action.openEditorAtIndex3" },
{ "key": "cmd+4", "command": "workbench.action.openEditorAtIndex4" },
{ "key": "cmd+5", "command": "workbench.action.openEditorAtIndex5" },
{ "key": "cmd+6", "command": "workbench.action.openEditorAtIndex6" },
{ "key": "cmd+7", "command": "workbench.action.openEditorAtIndex7" },
{ "key": "cmd+8", "command": "workbench.action.openEditorAtIndex8" },
{ "key": "cmd+9", "command": "workbench.action.openEditorAtIndex9" },
const timezone = [
'GMT-11:00 - Pacific/Midway',
'GMT-11:00 - US/Samoa',
'GMT-10:00 - US/Hawaii',
'GMT-09:00 - US/Alaska',
'GMT-08:00 - US/Pacific',
'GMT-08:00 - America/Tijuana',
'GMT-07:00 - US/Arizona',
'GMT-07:00 - US/Mountain',
'GMT-07:00 - America/Chihuahua',
@chuanxd
chuanxd / javascript-promise-finally.js
Created March 24, 2017 09:17
實做一個 promise finally
// http://bluebirdjs.com/docs/api/finally.html
Promise.prototype.end = function(fn) {
return new Promise((resolve, reject)=>{
this.then((res)=>{
fn(false, res)
resolve()
})
.catch((er)=>{
fn(true, er)
import styled from 'styled-components';
const isCurrent = (current, key) => current.group === key[0] && current.attr === key[1] ? true : false;
const hoverColor = '#9c9c9c';
const activeColor = '#00bbff';
const pressColor= '#6c6c6c';
export const BorderWrap = styled.div`
position: relative;
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.