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 htmlDecode(input){ | |
var e = document.createElement('div'); | |
e.innerHTML = input; | |
return e.childNodes[0].nodeValue; | |
} | |
function HtmlEncode(s) | |
{ | |
var el = document.createElement("div"); | |
el.innerText = el.textContent = s; |
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
// Like the with statement, but in ES6 and scoped only onto obj | |
const withES6 = function(obj, code){ | |
const scope = new Function(...Object.keys(obj), code); | |
scope(...Object.values(obj)); | |
}; | |
// Test | |
let myObj = { | |
res: {}, | |
a: 3, |
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
/* | |
Make the submit button "click" even when the keyboard is shown | |
http://stackoverflow.com/questions/24306818/form-submit-button-event-is-not-captured-when-keyboard-is-up-ios-7 | |
http://stackoverflow.com/questions/12690620/checking-if-touchend-comes-after-a-drag | |
Note: requires jQuery | |
*/ | |
$(function(){ | |
// Check if the user is dragging |
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
// IE polyfills needed by mithril for IE8 and below | |
// array.indexOf - https://gist.github.com/revolunet/1908355 | |
if (!Array.prototype.indexOf) | |
{ | |
Array.prototype.indexOf = function(elt /*, from*/) | |
{ | |
var len = this.length >>> 0; | |
var from = Number(arguments[1]) || 0; | |
from = (from < 0) |
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
<link rel="import" href="../chart-js/chart-js.html"> | |
<link rel="import" href="../ace-element/ace-element.html"> | |
<polymer-element name="my-element"> | |
<template> | |
<style> | |
:host { | |
position: absolute; | |
width: 100%; |
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
javascript:void((function(){$('#subscription-overlay').remove();$('body').css({overflow: 'auto'}); localStorage.clear(); var a,b,c,e,f;f=0;a=document.cookie.split("; ");for(e=0;e<a.length&&a[e];e++){f++;for(b="."+location.host;b;b=b.replace(/^(?:%5C.|[^%5C.]+)/,"")){for(c=location.pathname;c;c=c.replace(/.$/,"")){document.cookie=(a[e]+"; domain="+b+"; path="+c+"; expires="+new Date((new Date()).getTime()-1e11).toGMTString());}}};document.location.reload()})()) |
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"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Document</title> | |
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> | |
</head> | |
<body> | |
<p> |
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
.find('input:not(:disabled)') |
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> | |
<!--[if lt IE 9]><html class="ie"><![endif]--> | |
<!--[if gte IE 9]><!--><html><!--<![endif]--> | |
<!-- | |
The comment jumble above is handy for targeting old IE with CSS. | |
http://paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ | |
--> | |
<head> |
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
// Escape unwanted CSS selector chars | |
escapeForJquery = function(str) { | |
var charList = ["\\", "!", "\"", "#", "$", "%", "&", "'", "(", ")", "*", "+", "-", ",", ".", "/", ":", ";", "<", "=", ">", "?", "@", "[", "]", "^", "`", "{", "|", "}", "~"], | |
i, result = str; | |
for(i = 0; i < charList.length; i+=1) { | |
result = result.split(charList[i]).join("\\" + charList[i]); | |
} | |
return result; | |
}; |
NewerOlder