Skip to content

Instantly share code, notes, and snippets.

View jaysoo's full-sized avatar

Jack Hsu jaysoo

View GitHub Profile
@jaysoo
jaysoo / hack.sh
Created April 6, 2012 14:44 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@jaysoo
jaysoo / csp_nonce_demo.js
Created June 1, 2013 19:36
String escaping is the wrong solution to XSS prevention. Using the new nonce directive of Content Security Policy, we can prevent scripts from executing that don't have the valid nonce.
var express = require('express');
var app = express();
app.use(express.methodOverride());
// Naive nonce using just timestamp.
var nonce = new Date().valueOf();
var contentSecurityPolicy = function(req, res, next) {
res.header('Content-Security-Policy', "script-src 'self' 'nonce-" + nonce + "' http://ajax.googleapis.com");
@jaysoo
jaysoo / grunt-recurse-example.js
Last active December 18, 2015 08:08
Example of preventing execution of callbacks from grunt.file.recurse, until an async operation has returned.
/*
* GOAL: I want to perform an async task inside callback for grunt.file.recurse.
*
* This call should block subsequent recurse callbacks from executing until the
* async task is completed.
*/
var grunt = require('grunt');
// Path we are recursing into.
@jaysoo
jaysoo / grunt-recurse-example.js
Created June 10, 2013 21:16
Block subsequent grunt.file.recurse callbacks from executing until the an async task comes back.
/*
* GOAL: I want to perform an async task inside callback for grunt.file.recurse.
*
* This call should block subsequent recurse callbacks from executing until the
* async task is completed.
*/
var grunt = require('grunt');
// Path we are recursing into.
### Keybase proof
I hereby claim:
* I am jaysoo on github.
* I am jaysoo (https://keybase.io/jaysoo) on keybase.
* I have a public key whose fingerprint is BFC9 808A 5899 4F0E 0A99 2E53 49CC D477 8776 E138
To claim this, I am signing this object:
@jaysoo
jaysoo / software-development-talks.markdown
Last active August 29, 2015 14:09
Software development related talks that I enjoyed.
@jaysoo
jaysoo / hack.summit.2014.markdown
Last active April 7, 2018 19:58
Hack summit talks

Videos from hack.summit() 2014.

Day 1

Ed Roman - hack.summit() Opening remarks

Scott Hanselman - Author of multiple books on programming, podcaster, educator to half a million developers — Scaling Yourself

Floyd Marinescu - CEO, InfoQ — Culture and Happiness in Virtual Teams

@jaysoo
jaysoo / reactive-design-and-lang-paradigms.md
Last active August 29, 2015 14:14
Notes for Reactive Design & Language Paradigms
  • Composibility in functional programming is much better than object-oriented composition.

  • HTTP became a great vehicle because it does very little (just text and status codes).

  • Very easy to build on top of common data structures.

  • Referential transparency makes testing much easier.

  • Separation of state and behaviour is desirable.

@jaysoo
jaysoo / coding-exercise.md
Created March 4, 2015 15:04
Nulogy Coding Exercise

Instructions

  1. Please answer the following question using Ruby, JavaScript or Java without using any third party gems, plugins, or jar files with the exception of MiniTest/RSpec, Jasmine, or JUnit for tests.

  2. Treat this problem as a library. No UI or file/console input is expected or required.

  3. Please submit via publicly accessible repo so that we can review your commits.

This is a proposal to simplify our frontend workflow.

Current setup

  1. Work on JS source code in client/ folder.
  2. Run gulp watch, which will:
  • Compile Angular and Handlebars templates.
  • Copy client/**/* to public/client/app/, so source + compiled templates can be served through Rails.
  1. No-pipe sets client/app as the baseUrl for RequireJS.
  2. Third-party components are installed to public/client/bower_components/ (see bower.json).