Skip to content

Instantly share code, notes, and snippets.

View cacheflow's full-sized avatar
🎯
Focusing

Lex cacheflow

🎯
Focusing
View GitHub Profile
/** jsx dom */
let dom = (tag, attrs, ...children) => {
return {tag, attrs, children}
}
const list = (
<ul class="list">
<li> Hope </li>
<li> This </li>
@cacheflow
cacheflow / flux.js
Last active January 20, 2017 02:48
class Dispatcher {
constructor() {
this._id = 0
this._cbs = {}
}
register(cb) {
this._cbs[this._id] = cb
return this._id++
}
unregister(id) {
'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
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
(http|https):\/\/(www\.youtube\.com\/|youtu\.be\/)(watch\?v=.{11}|.{11})
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
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];
}
}
getPage(action, currentPage) {
let goToPage;
let userQuery = dom.getQueryFromPage()
this.fetchData(lookupPage(action)(currentPage), userQuery)
manipulateWindow.animateToTopOfPage()
}
lookupPage(goToPage) {
let pages = {
'prev': (page) {
for(let {category: c} of videos) {
categories.push(c)
}
let uniqueCategories = [...new Set(categories)]