Skip to content

Instantly share code, notes, and snippets.

View debuggingfuture's full-sized avatar

debuggingfuture (Vincent LCY) debuggingfuture

View GitHub Profile
//devise a simple algorithm for scoring similarity between phrases pairs
//sample input
//can assume all are short phrasese (<20 characters)
var input = [
["一二三四","五六七八"],
["分享帳號","帳號管理"]
]
@debuggingfuture
debuggingfuture / project_hk.js
Last active August 29, 2015 14:22
Converting HK1980Grid (EPSG:2326) into WGS84
var proj4 = require('proj4');
//https://github.com/proj4js/proj4js
//More on the systems
//http://www.geodetic.gov.hk/data/pdf/explanatorynotes.pdf
proj4.defs('WGS84', "+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees");
//HK co-ordinate system http://spatialreference.org/ref/epsg/hong-kong-1980-grid-system/
proj4.defs('EPSG2326','+proj=tmerc +lat_0=22.31213333333334 +lon_0=114.1785555555556 +k=1 +x_0=836694.05 +y_0=819069.8 +ellps=intl +towgs84=-162.619,-276.959,-161.764,0.067753,-2.24365,-1.15883,-1.09425 +units=m +no_defs');
//convert co-ordinates from HK 1980 to WGS84
var coordinatesWGS84 = proj4('EPSG2326','WGS84',[832699,836055]);
@debuggingfuture
debuggingfuture / code4hk-badge-analyticsjs.js
Last active August 29, 2015 13:57
Code4HK Badge CSS and HTML and Ga Tracking code
//https://developers.google.com/analytics/devguides/collection/analyticsjs/events
var downloadLink = document.getElementById('#code4hk-badge-link');
addListener(downloadLink, 'click', function() {
ga('send', 'event', 'link', 'click', 'code4hk-badge-link');
});
/**
CREATE SEQUENCE customers_seq
START WITH 1000
INCREMENT BY 1
NOCACHE
NOCYCLE;
@debuggingfuture
debuggingfuture / gist:5920345
Created July 3, 2013 16:46
Adding gist tag in Cheeatz
<gist id='yourgistid' />
@debuggingfuture
debuggingfuture / gist:5919532
Created July 3, 2013 15:41
Select element with classA AND classB
.classA.classB
@debuggingfuture
debuggingfuture / gist:5919522
Last active December 19, 2015 07:29
select element with class myClass and is descendants of element with id myID
div#myId .myClass
@debuggingfuture
debuggingfuture / cssselector.css
Created July 3, 2013 15:39
jQuery(CSS) selectors - Select Element with Id myId and also of class myClass
div#myId.myClass
@debuggingfuture
debuggingfuture / rightShift.groovy
Last active December 19, 2015 06:28
From mrhaki/Groovy-Goodness
// We add the method rightShift to the List class.
// The implementation is simply calling the remove method of List with
// the provided argument.
List.metaClass.rightShift {
delegate.remove it
}
def list = ['one', 'two', 'three', 'four']
assert 4 == list.size()
@debuggingfuture
debuggingfuture / gist:5792413
Created June 16, 2013 15:41
Use gist Tag to render Gist
Hello World!