Skip to content

Instantly share code, notes, and snippets.

View sunnycmf's full-sized avatar
🎯
Focusing

Sunny Chan sunnycmf

🎯
Focusing
  • Carousell
  • Hong Kong
View GitHub Profile
@sunnycmf
sunnycmf / date_dimension.sql
Last active October 4, 2023 19:24
MySQL Date Dimension generation SQL
-- Credit to http://www.dwhworld.com/2010/08/date-dimension-sql-scripts-mysql/
-- Small-numbers table
DROP TABLE IF EXISTS numbers_small;
CREATE TABLE numbers_small (number INT);
INSERT INTO numbers_small VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-- Main-numbers table
DROP TABLE IF EXISTS numbers;
CREATE TABLE numbers (number BIGINT);
INSERT INTO numbers
@erikreagan
erikreagan / mac-apps.md
Created August 4, 2012 19:18
Mac developer must-haves

Mac web developer apps

This gist's comment stream is a collection of webdev apps for OS X. Feel free to add links to apps you like, just make sure you add some context to what it does — either from the creator's website or your own thoughts.

— Erik

@sebastianhoitz
sebastianhoitz / StreamingResponse.coffee
Last active December 26, 2022 07:06
node.JS streaming zip file
zipstream = require "zipstream"
fs = require "fs"
async = require "async"
class StreamingResponse
filename: ""
files: []
streaming: true
###
@jwalton
jwalton / RickshawGraph.md
Last active July 30, 2021 02:35
Rickshaw Graph is a drop in replacement for Dashing's graph

Graphing Widget

The graphing widget shows graphs using the Rickshaw graphing library. The names of data fields should be (vaguely) familiar if you've used Rickshaw before.

It's recommended that you replace the /assets/javascripts/rickshaw.min.js from your dashboard with the latest from here.

Supported HTML data fields

{
"title": "Apache and Tomcat Logs",
"services": {
"query": {
"list": {
"0": {
"query": "apache !tomcat !static",
"alias": "",
"color": "#7EB26D",
"id": 0,
@jfsiii
jfsiii / img2data.js
Created January 30, 2011 23:30
base64 encoding images in NodeJS
/*
* Based on https://gist.github.com/583836 from http://stackoverflow.com/questions/3709391/node-js-base64-encode-a-downloaded-image-for-use-in-data-uri.
* 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 = 'http://nodejs.org/logo.png'
;
@sunnycmf
sunnycmf / yosemite-setup.md
Last active March 7, 2017 06:02
Mac OSX Yosemite dev env setup script

Mac OSX softwares and env setup

install homebrew & cask

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install caskroom/cask/brew-cask
brew tap caskroom/versions
brew update && brew upgrade brew-cask && brew cleanup && brew cask cleanup

Dev tools

@tyler-sommer
tyler-sommer / fix.rb
Created October 17, 2014 17:52
Fix broken gitlab hooks in your project repositories
Dir.glob('/home/git/repositories/**/*.git') do |item|
hook = "#{item}/hooks"
if not File.symlink?(hook)
puts "Updating #{hook}"
File.rename(hook, "#{hook}.old")
File.symlink("/home/git/gitlab-shell/hooks", hook)
end
end
anonymous
anonymous / Responsive-Flat-UI-Kit.markdown
Created December 5, 2013 05:56
A Pen by Matt Litherland.

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.

sudo su
vi /etc/sudoers