- @
- @
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 getType(value) | |
{ | |
var dtypes = [Function, RegExp, Number, String, Boolean, Object], x, len; | |
if (typeof value === "object" || typeof value === "function") { | |
for (x = 0, len = dtypes.length; x < len; x++) | |
{ | |
if (value instanceof dtypes[x]) | |
{ |
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 LetterChanges(str) { | |
var letters = str.split(''); | |
for (var i = 0; i < letters.length; i++) { | |
var letter = letters[i]; | |
if(/[a-yA-Y]/.test(letter)){ | |
letters[i] = String.fromCharCode(letter.charCodeAt(letter.length-1)+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
// via http://www.klauskomenda.com/code/javascript-inheritance-by-example/ | |
// create constructor function for base "class" | |
function Vehicle(hasEngine, hasWheels) { | |
this.hasEngine = hasEngine || false; | |
this.hasWheels = hasWheels || false; | |
} | |
// create constructor function | |
function Car (make, model, hp) { | |
this.hp = hp; |
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
## Setup steps via terminal: | |
# 1. create a .rb file : $ touch askwiki.rb | |
# 2. open file: $ open askwiki.rb | |
# 3. copy/paste below in file and close/save | |
# 4. run it: $ ruby askwiki.rb | |
require 'open-uri' | |
require 'json' | |
language = 'en' |
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
var testModule = (function () { | |
var counter = 0; | |
return { | |
incrementCounter: function () { | |
return counter++; | |
}, | |
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
App.Router.map(function() { | |
this.route("news", { | |
path: "/news" | |
}), this.route("entertainment", { | |
path: "/entertainment" | |
}), this.route("fashionBeauty", { | |
path: "/fashion-beauty" | |
}), this.route("lifestyle", { | |
path: "/lifestyle" | |
}), this.route("books", { |
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
if (window.location.href.indexOf('://custom.me') === 0) { | |
window.location.replace('http://projectname.io' + window.location.pathname); | |
} |
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 Promise() { | |
this.callbackQ = [], | |
this.errorQ = [], | |
this.then = function(callback, error){ | |
this.callbackQ.push(callback); | |
this.errorQ.push(error); | |
}, |
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
$(window).scroll($.debounce(50), function() { | |
if ($(window).scrollTop() === $(document).height() - $(window).height()) { | |
var nextId = $('.article:last').data('next'); // gets the id of 'next' article from markup. | |
$.get('/ajax-article/' + nextId, function(content) { // gets the html | |
$($('.article', content)).insertAfter('.article:last'); //insert html after last article |