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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Document</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<style> | |
#thing { |
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
var saveData = function (blob, fileName) { | |
var a = document.createElement("a"); | |
document.body.appendChild(a); | |
var url = window.URL.createObjectURL(blob); | |
a.href = url; | |
a.download = fileName; | |
a.click(); | |
window.URL.revokeObjectURL(url); | |
}; |
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() { | |
// These are the form fileds you want to fill | |
// All You have to do is define the classname of the field and url parameter you want to fill, it with | |
var formFields = [ | |
{ className: "field1", parameter: "value1" }, | |
{ className: "field2", parameter: "value2" }, | |
{ className: "field3", parameter: "value3" } | |
]; |
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
$('#box').css('display', 'none'); | |
var play = function() { | |
var boxes = $('#box span'), | |
color1 = {count: 0}, | |
color2 = {count: 0}, | |
lastColor1Item, lastColor2Item; | |
boxes.each(function(idx, item) { | |
var color = $(item).css('background-color'); | |
if (!color1.color) { |
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
{% capture page_title %}{% if article %}{{ article.title }} — {{ page.site_title }}{% else %}{% if site.root_item.selected? %}{{ page.site_title }}{% else %}{{ page.title }} — {{ page.site_title }}{% endif %}{% endif %}{% endcapture %} | |
{% comment %}<!-- FACEBOOK OPENGRAPH -->{% endcomment %} | |
{% if site.data.fb_admin %}<meta property="fb:admins" content="{{ site.data.fb_admin }}">{% endif %} | |
<meta property="og:type" content="{% if article %}article{% else %}website{% endif %}"> | |
<meta property="og:url" content="{{ site.url }}{% if article %}{{ article.url | remove_first:'/' }}{% else %}{{ page.url | remove_first:'/' }}{% endif %}"> | |
<meta property="og:title" content="{{ page_title | escape }}"> | |
<meta property="og:site_name" content="{{ page.site_title | escape }}"> | |
{% if article %} |
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
var preloadImage = function(src) { | |
var def = $.Deferred(), | |
preloadImg = $('<img/>'); | |
preloadImg.on('load', function() { | |
def.resolve(); | |
}); | |
preloadImg.attr('src', src); | |
return def.promise(); |
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
var color = "rgba(12, 23 , 34 , 0.2)"; | |
var getRGBA = function(colorStr) { | |
if (!colorStr || typeof colorStr !== 'string') { | |
return; | |
} | |
var arr = colorStr.match(/(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,?\s*([\d\.]+)?\s*)/); | |
if (arr) { | |
return { |
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
var a = "1"; | |
var b = "0"; | |
var c = "2.33" | |
console.log(+a); | |
// 1 | |
console.log(+b); | |
// 0 | |
console.log(+c); | |
// 2.33 |
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
// toggle between two list values | |
var i = 1, | |
toggleList = ['one', 'two']; | |
console.log(toggleList[i ^= 1]); // one | |
console.log(toggleList[i ^= 1]); // two | |
console.log(toggleList[i ^= 1]); // one | |
// toggle through longer array | |
// limitation: list values should not be falsy ("", null, 0) |