Skip to content

Instantly share code, notes, and snippets.

View yangshun's full-sized avatar
๐Ÿ˜Ž
Ruining websites since 2013

Yangshun Tay yangshun

๐Ÿ˜Ž
Ruining websites since 2013
View GitHub Profile
## Directory structure:
## dir
## |-- gen_runes.py
## |-- graphics.py
## |-- PyGif.py
## +-- runes.py
## Put submissions in the same directory as this file.
## Make sure there are no other .py files besides
## the submissions and the whitelisted files
var script = document.createElement('script');
script.src = '//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js';
script.onload = function () {
// Do something
}
document.getElementsByTagName('head')[0].appendChild(script);
@yangshun
yangshun / Gulpfile.js
Created August 11, 2016 13:00
Static web server with styles watching
'use strict';
var gulp = require('gulp');
var sass = require('gulp-sass');
var webserver = require('gulp-webserver');
gulp.task('sass', function () {
return gulp.src('./sass/**/*.scss')
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest('./css'));
@yangshun
yangshun / deep-dive-into-nusmods.md
Last active November 20, 2018 21:28
An explanation of how the timetabling algorithm of NUSMods works

Deep Dive into NUSMods

Ever wondered how the timetabling algorithm of NUSMods works? Read on to find out.

Firstly start let's define the data representation of a Lesson:

Lesson = {
  ClassNo: string,
 DayText: string,
@yangshun
yangshun / media-rename.sh
Created October 2, 2016 07:48
Rename .webm files to .mp4
#/usr/bin/sh
for f in *.webm; do
mv -- "$f" "${f%.webm}.mp4"
done
@yangshun
yangshun / emoticon-emoji.json
Created January 17, 2017 07:07
Mapping of common emoticons to their respective emojis
{
":)": "๐Ÿ™‚",
":-)": "๐Ÿ™‚",
"(:": "๐Ÿ™‚",
":D": "๐Ÿ˜„",
":-D": "๐Ÿ˜„",
"=D": "๐Ÿ˜ƒ",
"=-D": "๐Ÿ˜ƒ",
":')": "๐Ÿ˜‚",
":'-)": "๐Ÿ˜‚",

What I Wish I'd Known About Equity Before Joining A Unicorn

Disclaimer: This piece is written anonymously. The names of a few particular companies are mentioned, but as common examples only.

This is a short write-up on things that I wish I'd known and considered before joining a private company (aka startup, aka unicorn in some cases). I'm not trying to make the case that you should never join a private company, but the power imbalance between founder and employee is extreme, and that potential candidates would

// Name animater
var name = 'Yang.Shun.Tay.';
setInterval(function () {
name = name.substring(1) + name.charAt(0);
var flags = (1 << 0) | (1 << 1);
MtpApiManager.invokeApi('account.updateProfile', {
flags: flags,
first_name: name,
last_name: ''
@yangshun
yangshun / checlist.md
Created February 22, 2017 16:57 — forked from xdite/checlist.md

Security is Hard

Massive Assignment

  • watch for ActiveRecord Relation, like has_many, has_many :through
  • watch for user_roles, `group_users
  • UPDATE action

Admin

@yangshun
yangshun / README-Template.md
Created March 3, 2017 13:53 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites