Skip to content

Instantly share code, notes, and snippets.

View rogerz's full-sized avatar

Rogerz Zhang rogerz

View GitHub Profile
@justmoon
justmoon / custom-error.js
Last active June 26, 2024 09:36 — forked from subfuzion/error.md
Creating custom Error classes in Node.js
'use strict';
module.exports = function CustomError(message, extra) {
Error.captureStackTrace(this, this.constructor);
this.name = this.constructor.name;
this.message = message;
this.extra = extra;
};
require('util').inherits(module.exports, Error);
@rogerz
rogerz / module-wrapper.js
Last active December 30, 2015 07:49
wrap a script for CommonJS and AMD
/* https://github.com/yields/case/blob/master/dist/Case.js */
(function () {
var Case = {};
if (typeof define === 'function' && define.amd) {
define(function(){ return Case; });
} else if (typeof module !== 'undefined' && module.exports) {
module.exports = Case;
} else {
this.Case = Case;
}
@Mantish
Mantish / AuthController.js
Last active December 21, 2015 21:09 — forked from theangryangel/AuthController.js
Sails.js (v0.9.3) authentication using Passportmiddleware
// api/controllers/AuthController.js
var passport = require('passport');
var AuthController = {
login: function (req,res)
{
res.view();
},
C-x h (M-x mark-whole-buffer)
C-M-\ (M-x indent-region)
@jonathantneal
jonathantneal / README.md
Created September 19, 2012 06:34
Polyfill the EventListener interface in IE8

EventListener Polyfill

Is IE8 your new IE6? Level the playing field with polyfills.

This script polyfills addEventListener, removeEventListener, and dispatchEvent. It is less than half a kilobyte minified and gzipped.

addEventListener

addEventListener registers a single event listener on a single target.

@rogerz
rogerz / .gdbinit
Created July 13, 2012 12:09
ART development scripts
#
# J-LINK GDB SERVER initialization
#
# This connects to a GDB Server listening
# for commands on localhost at tcp port 2331
target remote localhost:2331
# Set JTAG speed to 30 kHz
# monitor speed 30
# Set GDBServer to big endian
# monitor endian big
@rogerz
rogerz / .gitconfig
Last active July 3, 2018 10:25
git
[alias]
la = log --graph --oneline --decorate --all
lg = log --graph --oneline --decorate --all
@marktheunissen
marktheunissen / pedantically_commented_playbook.yml
Last active August 26, 2024 11:06 — forked from phred/pedantically_commented_playbook.yml
Insanely complete Ansible playbook, showing off all the options
This playbook has been removed as it is now very outdated.
@rogerz
rogerz / winmerge.sh
Created September 16, 2011 01:23
winmerge script for msysGit
#!/bin/sh
# git config --global -e
#
# [diff]
# tool = winmerge
# [difftool "winmerge"]
# cmd = winmerge.sh $LOCAL $REMOTE $BASE
# [difftool]
# prompt = false
NULL="/dev/null"
@defunkt
defunkt / clients.md
Created April 18, 2010 14:09
A list of Gist clients.

Gist Clients

Want to create a Gist from your editor, the command line, or the Services menu? Here's how.

Editor Support