Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Sunny Chan sunnycmf

🎯
Focusing
  • Carousell
  • Hong Kong
View GitHub Profile
@pborreli
pborreli / import
Created May 10, 2010
Dealing with mass import in doctrine/pdo using pcntl_fork
View import
<?php
class importTask extends sfTask
{
protected function execute($arguments = array(), $options = array())
{
$xml = simplexml_load_file('file');
$users = array();
foreach ($xml->users as $user)
{
anonymous
anonymous / Responsive-Flat-UI-Kit.markdown
Created Dec 5, 2013
A Pen by Matt Litherland.
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.

@tyler-sommer
tyler-sommer / fix.rb
Created Oct 17, 2014
Fix broken gitlab hooks in your project repositories
View fix.rb
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
@sunnycmf
sunnycmf / yosemite-setup.md
Last active Mar 7, 2017
Mac OSX Yosemite dev env setup script
View yosemite-setup.md

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

@jfsiii
jfsiii / img2data.js
Created Jan 30, 2011
base64 encoding images in NodeJS
View img2data.js
/*
* 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'
;
@sebastianhoitz
sebastianhoitz / StreamingResponse.coffee
Last active Jan 8, 2020
node.JS streaming zip file
View StreamingResponse.coffee
zipstream = require "zipstream"
fs = require "fs"
async = require "async"
class StreamingResponse
filename: ""
files: []
streaming: true
###
View apache-and-tomcat-logs.json
{
"title": "Apache and Tomcat Logs",
"services": {
"query": {
"list": {
"0": {
"query": "apache !tomcat !static",
"alias": "",
"color": "#7EB26D",
"id": 0,
@jwalton
jwalton / RickshawGraph.md
Last active Sep 18, 2020
Rickshaw Graph is a drop in replacement for Dashing's graph
View RickshawGraph.md

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

@sunnycmf
sunnycmf / date_dimension.sql
Last active Feb 18, 2021
MySQL Date Dimension generation SQL
View date_dimension.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