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 once(fn, context) { | |
var result; | |
return function() { | |
if(fn) { | |
result = fn.apply(context || this, arguments); | |
fn = null; | |
} | |
return result; |
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
module.exports = function(grunt) { | |
require('jit-grunt')(grunt); | |
grunt.initConfig({ | |
path: { | |
'static': 'static', | |
'src': 'src', | |
'node': 'node_modules' | |
}, | |
less: { |
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 encodeQueryData(data) { | |
var ret = []; | |
for (let d in data) | |
ret.push(encodeURIComponent(d) + '=' + encodeURIComponent(data[d])); | |
return ret.join('&'); | |
} |
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 events = (function(){ | |
var topics = {}; | |
var hOP = topics.hasOwnProperty; | |
return { | |
subscribe: function(topic, listener) { | |
// Create the topic's object if not yet created | |
if(!hOP.call(topics, topic)) topics[topic] = []; | |
// Add the listener to queue |
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
// https://davidwalsh.name/function-debounce | |
debounce = function(func, wait, immediate) { | |
var timeout; | |
return function() { | |
var context = this, args = arguments; | |
var later = function() { | |
timeout = null; | |
if (!immediate) func.apply(context, args); | |
}; | |
var callNow = immediate && !timeout; |
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
<!doctype html> | |
<html lang="en" prefix="og: http://ogp.me/ns/website#"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Title</title> | |
<meta name="description" content="Description"> | |
<!-- og --> |
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
// https://davidwalsh.name/javascript-attributes | |
Array.prototype.slice.call(document.getElementById("myId").attributes).forEach(function(item) { | |
console.log(item.name + ': '+ item.value); | |
}); |
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
/* visibility */ | |
.hidden { | |
display: none!important; | |
} | |
@media (max-width: 599px) { | |
.hidden-p { display: none!important; } | |
} | |
@media (min-width: 600px) and (max-width: 899px) { | |
.hidden-tp { display: none!important; } | |
} |
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
/* https://stackoverflow.com/questions/28217486/font-renders-thicker-in-browsers */ | |
body { | |
-moz-osx-font-smoothing: grayscale; | |
-webkit-font-smoothing: antialiased; | |
} |
OlderNewer