Skip to content

Instantly share code, notes, and snippets.

@notdol
notdol / jquery:plugins:init
Created September 17, 2013 06:44
jquery:plugins:init
(function($){
$.fn.method = function(customOptions){
var options = $.extend({},$.fn.method.defaultOptions,customOptions);
return this.each(function(){
var $this = $(this);
if($.isFunction(options.complete)){
options.complete.apply(this);
@notdol
notdol / nodejs-package.json
Created October 10, 2013 01:59
nodejs-package.json
{
"name": "http-server",
"preferGlobal": true,
"version": "0.3.0",
"author": "Nodejitsu <[email protected]>",
"description": "a simple zero-configuration command-line http server",
"contributors": [
{
"name": "Marak Squires",
"email": "[email protected]"
function throttle( fn, time ) {
var t = 0;
return function() {
var args = arguments, ctx = this;
clearTimeout(t);
t = setTimeout( function() {
fn.apply( ctx, args );
}, time );
};
@notdol
notdol / git command.md
Created January 7, 2014 12:57
git command

Gist

Reference : git book

Source Commit

 > git add . 
 > git commit -m "first commit" // commit local storage
 > git push 					// push source code to server
@notdol
notdol / css : top-center-bottom
Created January 14, 2014 14:09
css: top-center-bottom
html,body,#wrapper {
height:100%;
padding:0;
margin:0;
}
#wrapper {
position:relative;
}
#top, #middle, #bottom {
var injector = {
dependencies: {},
register: function(key, value) {
this.dependencies[key] = value;
},
resolve: function() {
var func, deps, scope, args = [], self = this;
if(typeof arguments[0] === 'string') {
func = arguments[1];
deps = arguments[0].replace(/ /g, '').split(',');
/* Polyfill EventEmitter. */
var EventEmitter = function () {
this.events = {};
};
EventEmitter.prototype.on = function (event, listener) {
if (typeof this.events[event] !== 'object') {
this.events[event] = [];
}
/* Polyfill EventEmitter. */
var Queue = function () {
this.events = {};
this.queue = [];
this.methodStr;
this.current;
};
Queue.prototype.setMethod = function(methodStr){
this.methodStr = methodStr;
@notdol
notdol / gist:83e5a8288e9682d50d33
Created February 23, 2015 11:21
send url location to server
(function(){
var server = 'http://www.notdol.com:8001';
var hostname = location.protocol +'//'+ location.hostname;
var parameters = location.search;
var context = location.href.replace(hostname,'').replace(parameters,'');
function ajaxRequest(){
var activexmodes=["Msxml2.XMLHTTP", "Microsoft.XMLHTTP"] //activeX versions to check for in IE
if (window.ActiveXObject){ //Test for support for ActiveXObject in IE first (as XMLHttpRequest in IE7 is broken)
for (var i=0; i<activexmodes.length; i++){
@notdol
notdol / gist:d9b659b856d2d801738c
Created September 18, 2015 07:06
between two quatations
"(?:\\?.\r?\n?)*?"