Skip to content

Instantly share code, notes, and snippets.


Sunny Chan sunnycmf

  • Carousell
  • Hong Kong
View GitHub Profile
View Responsive-Flat-UI-Kit.markdown

Responsive Flat UI Kit

A custom UI set built to work with and sit next to Bootstrap 3. Custom select boxes by @catalinred. 3D Scroll effects inspired by @chriscoyier's slide in when scroll down pen. The kit is also responsive!

Try clicking & hovering everything.

Feel free to fork, heart and share!

A Pen by Matt Litherland on CodePen.

View img2data.js
* Based on from
* Neither that gist nor this one work for me in 0.2.x or 0.3.x.
var request = require('request'),
BufferList = require('bufferlist').BufferList,
sys = require('sys'),
bl = new BufferList(),
url = ''
sunnycmf / node_image_resize_to_s3.js
Created Feb 17, 2014 — forked from simenbrekken/uploader.js
nodejs - image resize using magick to AWS S3
View node_image_resize_to_s3.js
var spawn = require('child_process').spawn,
aws2js = require('aws2js'),
http = require('http'),
urlutil = require('url')
mime = require('mime'),
Buffers = require('buffers');
var settings = {
s3: {
key: 'key',
sunnycmf / calc_file_checksum
Created Feb 18, 2014 — forked from guybrush/gist:721762
calculate a file sha1 checksum
View calc_file_checksum
#!/usr/bin/env node
require('fs').readFile('image.png',function(err, data){
zipstream = require "zipstream"
fs = require "fs"
async = require "async"
class StreamingResponse
filename: ""
files: []
streaming: true

High level style in javascript.

Opinions are like assholes, every one has got one.

This one is mine.

Punctuation: who cares?

Punctuation is a bikeshed. Put your semicolons, whitespace, and commas where you like them.

View gist:9175797
class PassAPI extends Plugin
# Registration
# register a device to receive push notifications for a pass
# POST /v1/devices/<deviceID>/registrations/<typeID>/<serial#>
# Header: Authorization: ApplePass <authenticationToken>
# JSON payload: { "pushToken" : <push token, which the server needs to send push notifications to this device> }
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl | sh
View index.js
// This module loads a config file in the current working directory matching the NODE_ENV variable.
// I.e. either './development.js' or './production.js' based on the process.env.NODE_ENV variable.
// If not set, it defaults to './development.js'.
// Can load custom environment files as well, as long as the NODE_ENV variable matches
// a file in the current directory. E.g. './staging.js'
// Usage: calling code can just require this module, e.g. "var config = require('./config')"
// assuming this file is named "index.js" and lives in a subdirectory named "config" of the app root.
var config
, config_file = './' + (process.env.NODE_ENV ? process.env.NODE_ENV : 'development') + '.js';
View passbook.rb
%w(pathname json openssl net/http digest/sha1 zip).each { |lib| require lib }
module Passbook
def self.wwdr_certificate <<-EOF.gsub /^\s+/, ""