This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title></title> | |
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"> | |
<script src="https://code.jquery.com/jquery-2.1.1.js"></script> | |
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script> | |
<script src="modal.js"></script> | |
</head> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Date.prototype.getDaysInMonth = function () { | |
return (new Date(this.getFullYear(), this.getMonth() + 1, 0)).getDate(); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:var links=document.getElementsByClassName('fileThumb');for(var i in links){if(links.hasOwnProperty(i)){var images=links[i].getElementsByTagName('img');console.log(images.length);ImageExpansion.toggle(images.length===1?images[0]:images[1]);}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.fn.drag = function () { | |
var $this = $(this); | |
$this.data('move', false); | |
$this.mousedown(function (e) { | |
e.preventDefault(); | |
$this.data('move', true); | |
$this.data('start', [e.offsetX, e.offsetY]); | |
}); | |
$(document).mouseup(function (e) { | |
e.preventDefault(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.fn.getPath = function () { | |
var $this = $(this), _parents = $this.parents(), parents = [], getIndex = function (node, className) { | |
var name = node.get(0).tagName.toLowerCase(), parent = node.parent(), siblings = parent.children(name + className); | |
if (siblings.length > 1) { | |
return ':nth-child(' + (siblings.index(node) + 1) + ')'; | |
} | |
return ''; | |
}, getClass = function (className) { | |
className = $.trim(className); | |
if (!className) return ''; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* src - http://stackoverflow.com/questions/4964197/converting-a-number-base-10-to-base-62-a-za-z0-9 | |
*/ | |
class Base62 { | |
public static $table = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; | |
public static function encode($num) { | |
$base = 62; | |
$table = self::$table; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function findKey (obj, predicant) { | |
var key = null; | |
_.find(obj, function (v, k) { | |
if (predicant(v, k, obj)) { | |
key = k; | |
return true; | |
} | |
return false; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function isNumeric (obj) { | |
return !_.isArray(obj) && (obj - parseFloat(obj) + 1) >= 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function deepClone (obj, depth) { | |
var clone; | |
if (!obj || (typeof obj !== 'object')) { | |
clone = obj; // by value | |
} else if (_.isString(obj)) { | |
clone = String.prototype.slice.call(obj); | |
} else if (_.isDate(obj)) { | |
clone = new Date(obj.valueOf()); | |
} else if (_.isFunction(obj.clone)) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// crypto = require('crypto') | |
crypto.createHash('md5').update('string').digest('hex'); |
OlderNewer