Skip to content

Instantly share code, notes, and snippets.

View coderek's full-sized avatar
👽

Derek Zeng coderek

👽
View GitHub Profile
@coderek
coderek / index.html
Last active March 26, 2018 02:48
Vue 2.0 - 2 way data binding deeper analysis
<!DOCTYPE html>
<html>
<head>
<title>Test 2 way data binding</title>
</head>
<body>
<div id="app">{{ abc }} - {{ def }} = {{ abc-def }} </div>
<button id='add'>add</button>
<button id='double'>double</button>
<script src='main.js'></script>
// https://stackoverflow.com/questions/9272232/fft-library-in-android-sdk
public class FFT {
int n, m;
// Lookup tables. Only need to recompute when size of FFT changes.
double[] cos;
double[] sin;
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>index</title>
</head>
<body>
<label for="Input">Input</label>
<input type="text" name="Input" value="" id="Input">
<ul id="suggestions">
Ria 89.7 | http://mediacorp.rastream.com/897fm
Gold 90.5 FM | http://mediacorp.rastream.com/905fm
91.3 Hot FM | http://sph.rastream.com/913fm
Kiss 92.0 | http://sph.rastream.com/sph-kiss92
Symphony 92.4 | http://mediacorp.rastream.com/924fm
Yes 93.3 | http://mediacorp.rastream.com/933fm
93.8 Live | http://mediacorp.rastream.com/938fm
Warna 94.2 | http://mediacorp.rastream.com/942fm
Class 95.0 | http://mediacorp.rastream.com/950fm
95.8 Capital | http://mediacorp.rastream.com/958fm
var s = new BouncingCanvasShapesStage();
var option = {
particleWidth: 10,
particleHeight: 10,
};
var benchmark = new BouncingCanvasShapesBenchmark(
{
// controller: 'adaptive',
// "test-interval": 1000,
complexity: 200,
static List<Integer> search(String pattern, String text) {
int[] pi = buildTable(pattern);
return kmpSearch(text, pattern, pi);
}
static List<Integer> kmpSearch(String text, String pattern, int[] pi) {
List<Integer> res = new ArrayList<>();
int p = 0;
for (int i=0;i<text.length();i++) {
while (p>0 && text.charAt(i) != pattern.charAt(p)) {
@coderek
coderek / list_merge_sort.py
Last active September 27, 2017 17:12
Shortest merge sort (in place, stable)
def list_merge_sort(l, start, end):
if start >= end - 1: return l
m = (start + end) // 2
l = list_merge_sort(l, start, m)
l = list_merge_sort(l, m, end)
start_head = l
start_parent = None
mid_head = l
# https://code.google.com/codejam/contest/dashboard?c=635101#s=p0
def solve(inputs):
itr = iter(input)
a = int(itr.next())
for i in range(a):
m, n = map(lambda c: int(c), itr.next().split(' '))
exists = [itr.next() for j in range(m)]
targets = [itr.next() for k in range(n)]
print 'Case #{}: {}'.format(i+1, _solve(exists, targets))
[{"body":"It is indeed amazing how much of an impact art has in helping someone find their way around in life. \n\nHere is an example: Mr Barry Yeow had spent over 20 years of his life behind bars for various drug and gang-related activities. He was finally able to turn his life around after he discovered his passion for art.\n\n#SpreadYRLove\n#SecondChancesEveryday\n\nhttps://www.youtube.com/watch?v=rSkOXnHuxZE","liked":false,"link":"https://www.youtube.com/watch?v=rSkOXnHuxZE","likes":46,"from":{"name":"Yellow Ribbon Project Singapore","id":"321854601115"},"image":"https://external.xx.fbcdn.net/safe_image.php?d=AQBHsYQa46pHxS8V&w=720&h=720&url=https%3A%2F%2Fi.ytimg.com%2Fvi%2FrSkOXnHuxZE%2Fmaxresdefault.jpg&cfs=1","create_at":"2016-05-19T23:50:00+0000","id":"321854601115_10153353945481116","shares":7,"comments":1},{"body":"Often times, we judge others without knowing the story behind their actions. This may sometimes cause us more harm, as many of our problems are caused by how we process things around us.\
[alias]
co = checkout
l = log --no-merges --pretty=medium --branches=develop,HEAD
lg = log --graph --abbrev-commit --decorate --date=relative --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --no-merges --branches=develop,HEAD
s = status
last = log -1 HEAD
b = branch
br = branch -r
cb = checkout -b
ss = stash save