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
/** jsx dom */ | |
let dom = (tag, attrs, ...children) => { | |
return {tag, attrs, children} | |
} | |
const list = ( | |
<ul class="list"> | |
<li> Hope </li> | |
<li> This </li> |
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
class Dispatcher { | |
constructor() { | |
this._id = 0 | |
this._cbs = {} | |
} | |
register(cb) { | |
this._cbs[this._id] = cb | |
return this._id++ | |
} | |
unregister(id) { |
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 counter() { | |
var today = new Date(); //variable contains current date and time | |
var days = calcDays(today); //calculate the time left until set date below | |
document.countDown.daysLeft.value = Math.floor(days); // displays days rounded to the next lowest integer | |
var hours = (days - Math.floor(days)) * 24; //calculate the hours left in the current day | |
document.countDown.hrLeft.value = Math.floor(hours); // display hours rounded to the next lowest integer | |
var minutes = (hours - Math.floor(hours)) * 60; // calculate the minutes left in the current hour |
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 findSum(list, sum) { | |
let listCopy = list.slice(0).sort() | |
let start = 0 | |
let end = list.length - 1 | |
while(start <= end ) { | |
if(list[start] + list[end] == sum) { | |
return true | |
} | |
else if(list[start] + list[end] > sum) { | |
start += 1 |
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
(http|https):\/\/(www\.youtube\.com\/|youtu\.be\/)(watch\?v=.{11}|.{11}) |
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
JS_PATH = "app/assets/javascripts/**/*.js"; | |
Dir[JS_PATH].each do |file_name| | |
puts "\n#{file_name}" | |
puts Uglifier.compile(File.read(file_name)) | |
end |
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 mergeDeep(destinationObj, sourceObj) { | |
for (var property in sourceObj) { | |
if (ensureIsObject(sourceObj[property], sourceObj[property].constructor)) { | |
destionationObj[property] = destionationObj[property] || {}; | |
mergeDeep(destionationObj[property], sourceObj[property]); | |
} | |
else { | |
destionationObj[property] = sourceObj[property]; | |
} | |
} |
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
getPage(action, currentPage) { | |
let goToPage; | |
let userQuery = dom.getQueryFromPage() | |
this.fetchData(lookupPage(action)(currentPage), userQuery) | |
manipulateWindow.animateToTopOfPage() | |
} | |
lookupPage(goToPage) { | |
let pages = { | |
'prev': (page) { |
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
for(let {category: c} of videos) { | |
categories.push(c) | |
} | |
let uniqueCategories = [...new Set(categories)] |
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
page.search('.colmask')[0].children.search("ul > li > a").each do |a| a["href"].tr("/(^\/\/)(\w+)/", "").split(".").delete_if {|href| href == "craigslist" || href == "org"}.map {|link| links << link} end |