Skip to content

Instantly share code, notes, and snippets.

View piratefsh's full-sized avatar

Sher Minn Chong piratefsh

View GitHub Profile
#!/usr/bin/env node
const fs = require('fs');
const jSmart = require('../../jsmart');
const tpl = fs.readFileSync('./test-file.tpl', {encoding: 'utf-8'});
debugger;
const compiledTemplate = new jSmart(tpl, {autoLiteral: false, ldelim: "{%", rdelim: "%}"});
// const output = compiledTemplate.fetch({my_variable: 'Hello World', my_conditional: true});
// // output will be "Hello world"

Keybase proof

I hereby claim:

  • I am piratefsh on github.
  • I am sherminn (https://keybase.io/sherminn) on keybase.
  • I have a public key ASBdx7Nt-xsUJlfWNHasXIxZFbEvSbXL5w0W3yIqjGY_jwo

To claim this, I am signing this object:

<!DOCTYPE html>
<html>
<head>
<title>Interactive Features</title>
</head>
<body>
<ul id="my-list">
<li id="1">item1</li>
<li id="2">item2</li>
# quick and dirty scraper to get images from http://hm.onemap.sg/
# requires requests module
import requests
import os
def get_image(url, filename):
r = requests.get(url)
if r.status_code == 200:

Lessons from deleting code

Deleting unused code is part of a healthy codebase. Every now and then, a feature gets decommissioned and an engineer is tasked with removing it. Sometimes I'm that engineer. It seems like a trivial thing to write about, but I was pleasantly surprised by how non-straightforward it can be, especially if you're doing it for the first time. There're lots of learning points, especially on how code organization really matters when it comes to maintainability.

Decommissioning a feature is more than just turning it off. It also means hunting down all the parts of code that is no longer needed. And that can be pretty tricky.

It goes without saying that this is by no means the only way to go about doing it. It also really depends on how your codebase is organized. Hopefully this will give you some idea on where to start and things to look out for when you're doing code cleanup.

For some context, our web client at Viki is on the following stack:

  • Frameworks/Libraries: Ruby on Rails
Cartoon guide to React performance
- shouldComponentUpdate() -- reduces render update given similar state
- setState at lower levels in tree
- state immutability
Reactive Animation
- david khourshd
- http://conal.net/papers/icfp97/
- RXCSS (dynamic variables in css)

##Sublime linter setup Displays warnings and errors from ESLint. You need eslint installed. See readme of https://github.com/roadhump/SublimeLinter-eslint for eslint installation instructions

  1. With Package Manager, install SublimeLinter and SublimeLinter-contrib-eslint
  2. Cmd+Shift+P should now have a SublimeLinter: Lint This View option
  3. Running that should lint your file. It should also run the linter on file load and save (configurable on SublimeLinter settings)

##Sublime formatter setup Autoformats your files according to ESLint --fix option

### batch convert image with imagemagick, preserve filename
for i in *.png; do convert "$i" -resize 400 "retina/${i%.*}@2x.png"; done

JavaScript, the weird parts

link to notes https://git.io/vgpKc

about Sher Minn

  • front-end web engineer
  • funemployed, but joining Viki.com in a week
  • recently spent 3 months in NYC at the Recurse Center
    • retreat for programmers
  • where people go to be better at what they do

JavaScript, the weird parts

JavaScript can be mysterious and weird, let's just all admit that. In this talk, we'll explore all the wonderful obscure, weird bits of JavaScript, and how to befriend them so they don't bite you in the ass (if they haven't already). For example we'll explore things like:

Why on earth does this work:

foo();

function foo(){

console.log('foo');