Skip to content

Instantly share code, notes, and snippets.

@pingyen
pingyen / twd97Conv.php
Last active April 30, 2023 15:47
Transform TWD97 to Latitude Longitude
<?php
function twd97_to_latlng($x, $y) {
$a = 6378137.0;
$b = 6356752.314245;
$lng0 = 121 * M_PI / 180;
$k0 = 0.9999;
$dx = 250000;
$dy = 0;
$e = pow((1 - pow($b, 2) / pow($a, 2)), 0.5);
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = [email protected]:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@dctrwatson
dctrwatson / nginx.conf
Last active April 28, 2024 10:23
Caching NPM proxy using Nginx
user www-data;
worker_processes 4;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
@eyecatchup
eyecatchup / how-to-install.txt
Last active November 17, 2019 17:43
Instructions how to install (and run) "Leapcast" on Windows.
1. Download https://github.com/dz0ny/leapcast/archive/master.zip
2. Extract zip to C:\leapcast
3.1 Download Python 2.7:
x86: http://www.python.org/ftp/python/2.7.5/python-2.7.5.msi
x64: http://www.python.org/ftp/python/2.7.5/python-2.7.5.amd64.msi
3.2 Install Python to C:\Python27
NOTE: If you have a newer version, install 2.7.5 and edit the environment variable and change for example "C:\Python33" to "C:\Python27".
4.1 Download Setuptools here: http://www.lfd.uci.edu/~gohlke/pythonlibs/#setuptools
@edokeh
edokeh / index.js
Last active July 3, 2025 23:09
佛祖保佑,永无 BUG
//
// _oo0oo_
// o8888888o
// 88" . "88
// (| -_- |)
// 0\ = /0
// ___/`---'\___
// .' \\| |// '.
// / \\||| : |||// \
// / _||||| -:- |||||- \
@kejyun
kejyun / node.js_multi-connections_pool_example.js
Created December 13, 2013 06:39
Node.js的MySQL連線池(connections pool)操作範例
// 引用MySQL函式庫
var mysql = require('mysql');
// 建立資料庫連線池
var pool = mysql.createPool({
user: '資料庫帳號',
password: '資料庫密碼',
host: '主機位置',
port: '資料庫port'
database: '資料庫名稱',
// 無可用連線時是否等待pool連線釋放(預設為true)

Setup

  1. 在GitHub網站上點擊repository的Fork按鈕

  2. 在電腦上Clone你建立的fork

    • git clone https://github.com/user/repo.git
    • <或>
    • 在你的fork點擊Clone in Desktop按鈕
/**
* Specifications
* http://wiki.ecmascript.org/doku.php?id=harmony:simple_maps_and_sets
*/
(function () {
"use strict";
/** A non-stupid alternative to Array.prototype.indexOf */
function indexOfIdentical(keys, key) {
/*jshint multistr: true */
// 全ての艦名 (改造艦は含まない)
var allKanmusu =
"長門, 陸奥, 伊勢, 日向, 雪風,\
赤城, 加賀, 蒼龍, 飛龍, 島風,\
吹雪, 白雪, 初雪, 深雪, 叢雲,\
磯波, 綾波, 敷波, 大井, 北上,\
金剛, 比叡, 榛名, 霧島, 鳳翔,\
@CrocoDillon
CrocoDillon / cookies.js
Last active February 11, 2024 22:42
Export your awesome module using AMD, CommonJS, Node.js or just as global.
/*
* Inspiration (well… copy pasting more or less) from:
* https://github.com/ScottHamper/Cookies/blob/0.3.1/src/cookies.js#L127-L140
*
* Thanks Scott!
*/
(function (global) {
'use strict';
var MyModule = function () {