Skip to content

Instantly share code, notes, and snippets.

// http://werxltd.com/wp/2010/05/13/javascript-implementation-of-javas-string-hashcode-method/
String.prototype.hashCode = function(){
var hash = 0;
if (this.length == 0) return hash;
for (i = 0; i < this.length; i++) {
char = this.charCodeAt(i);
hash = ((hash<<5)-hash)+char;
hash = hash & hash;
}
@ickata
ickata / localhost-ssl.md
Created February 12, 2018 12:30 — forked from ethicka/localhost-ssl.md
Local virtualhost SSL websites on Mac OS Sierra

Local virtualhost SSL websites on Mac OS Sierra

These instructions will guide you through the process of setting up a wildcard SSL for your local virtualhosts for offline development. Most importantly, this configuration will give you the happy, green lock in Chrome.

These instructions have only been tested on Mac OS Sierra using the pre-installed Apache and PHP versions. These instructions also assume you have virtualhosts set up locally already.


Configuring SSL

@ickata
ickata / Element.getParentLimited
Last active August 29, 2015 14:07
(MooTools) Additional method in Element.prototype - getParentLimited - traverse DOM tree up to `limit` elements; returns null if `selector` does not match
Element.implement({
getParentLimited : function ( selector, limit ) {
limit = typeOf( limit ) == 'number' ? limit : 10;
var element = this;
do {
element = element.getParent();
} while ( element && ! element.match( selector ) && --limit > 0 );
return limit ? element : null;
}
});