This file contains hidden or 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
license: mit |
This file contains hidden or 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 getWikipediaSearchResults(term) { | |
return Rx.Observable.create(function forEach(observer) { | |
var cancelled = false; | |
var url = 'http://en.wikipedia.org/w/api.php?action=opensearch&format=json&search=' | |
+ encodeURIComponent(term) + '&callback=?'; | |
$.getJSON(url, function(data) { | |
if (!cancelled) { | |
observer.onNext(data[1]); | |
observer.onCompleted(); | |
} |
This file contains hidden or 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
@media | |
only screen and (-webkit-min-device-pixel-ratio: 2), | |
only screen and ( min--moz-device-pixel-ratio: 2), | |
only screen and ( -o-min-device-pixel-ratio: 2/1), | |
only screen and ( min-device-pixel-ratio: 2), | |
only screen and ( min-resolution: 192dpi), | |
only screen and ( min-resolution: 2dppx) { | |
/* Retina-specific stuff here */ |
This file contains hidden or 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 chunk(arr, size) { | |
if(!Array.isArray(arr)) { | |
throw new TypeError("Input is not an array"); | |
} | |
size = size || 1; //default size | |
if(size > arr.length) { | |
return arr; | |
} else { | |
var i = 0; | |
var j = size; |
This file contains hidden or 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
.dis-block { | |
display: block; | |
} | |
.dis-inline-block { | |
display: inline-block; | |
} | |
.dis-inline { | |
display: inline; |
This file contains hidden or 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 sortObject(o) { | |
var sorted = {}, a = [],key; | |
//Get array keys | |
a = Object.keys(o); | |
//Sort it | |
a.sort(); | |
//Construct object by iteration | |
for (key = 0; key < a.length; key++) { | |
sorted[a[key]] = o[a[key]]; | |
} |