Skip to content

Instantly share code, notes, and snippets.

View kelvintaywl's full-sized avatar

Kelvin Tay kelvintaywl

View GitHub Profile
@kelvintaywl
kelvintaywl / index.html
Created January 26, 2013 17:39
Sticky Navbar with CSS Sprites - My first doodle using a fixed navbar where the navbar icons are crafted using CSS Sprite technique. Enjoy! (on Codepen)
<html>
<head>
<title>Testing CSS Sprites | Kelvin Tay 2013</title>
<meta name="description" content="playing around with CSS Sprites">
<meta name="author" content="Kelvin Tay [kelvintaywl@gmail.com]">
<!-- CSS here -->
<link rel="stylesheet" href="sprite.css"></link>
</head>
<body>
<div id="menu">
@kelvintaywl
kelvintaywl / hiranga-flashcards.py
Last active December 17, 2015 14:59
A quick 'flashcard' script I wrote in less than an hour to test my knowledge of the Japanese Hiragana characters learnt so far. Feel free to use this in whatever way you like, especially if you have also just started learning Japanese as well :)
#!/usr/bin/python
# -*- coding: utf-8 -*-
# hiragana flashcards by Kelvin Tay [kelvintaywl@gmail.com]
import random
hira = [['-a', u'あ'],['-i', u'い'],['-u', u'う'],['-e', u'え'],['-o', u'お'],
['ka', u'か'],['ki', u'き'],['ku', u'く'],['ke', u'け'],['ko', u'こ'],
['sa', u'さ'],['shi', u'し'],['su', u'す'],['se', u'せ'],['so', u'そ'],
['ta', u'た'],['chi', u'ち'],['tsu', u'つ'],['te', u'て'],['to', u'と'],
['na', u'な'],['ni', u'に'],['nu', u'ぬ'],['ne', u'ね'],['no', u'の'],
@kelvintaywl
kelvintaywl / RaharjoQueue.java
Last active August 29, 2015 14:07
kennyroharjo_deque
import java.util.ArrayList;
import java.util.List;
import java.util.Collections;
import java.util.Comparator;
import java.util.Arrays;
public class RaharjoQueue {
static int DEFAULT_PACK_SIZE = 3;
private List<String> customers; // list of customers in original order
@kelvintaywl
kelvintaywl / csv.py
Last active August 29, 2015 14:07
csv deal
def get_summary(scores, wafer_num):
if wafer_num not in scores:
return None
wafer_scores = scores[wafer_num]
formula = '+'.join(map(str,wafer_scores))
sumScore = sum(wafer_scores)
return "For Wafer #%d, the score is %s=%d , the count is %d" % (wafer_num, formula, sumScore, len( wafer_scores))
csv_file = open('YOUR CSV FILE PATH', 'r')
scores = {}
@kelvintaywl
kelvintaywl / dd.md
Created March 11, 2015 05:35
test font

hello world hello 世界

@kelvintaywl
kelvintaywl / style.css
Created April 20, 2015 07:41
goship custom csss
.navbar.live {
background: red !important;
}
.navbar.staging {
background: blue !important;
}
.navbar.dev {
background: green !important;
@kelvintaywl
kelvintaywl / gengo.js
Created April 20, 2015 08:24
goship custom js
alert('Buongiorno!');
@kelvintaywl
kelvintaywl / split.py
Last active May 9, 2024 11:39
Python Script to split CSV files into smaller files based on number of lines
import csv
import sys
import os
# example usage: python split.py example.csv 200
# above command would split the `example.csv` into smaller CSV files of 200 rows each (with header included)
# if example.csv has 401 rows for instance, this creates 3 files in same directory:
# - `example_1.csv` (row 1 - 200)
# - `example_2.csv` (row 201 - 400)
# - `example_3.csv` (row 401)
@kelvintaywl
kelvintaywl / tenary_shorthand.php
Last active October 9, 2015 04:42
daily learnings @ gengo
$a = 2;
$default = 1;
// same as the following command:
// $b = $a? $a : $default;
$b = $a ?: $default;
@kelvintaywl
kelvintaywl / test.md
Created August 22, 2016 02:57
Running unit tests for Translate Core

Examples

./phpunit --filter test_get_priority_jobs 

./phpunit models/JobModelTest.php