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 getURLParameter(name) { | |
return decodeURI((RegExp(name + '=' + '(.+?)(&|$)').exec(location.search)||[,null])[1]); | |
} | |
function hideURLParams() { | |
//Parameters to hide (ie ?success=value, ?error=value, etc) | |
var hide = ['success','error']; | |
for(var h in hide) { | |
if(getURLParameter(h)) { | |
history.replaceState(null, document.getElementsByTagName("title")[0].innerHTML, window.location.pathname); | |
} |
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
//Get a range of numbers between two numbers | |
//Usage: [1, 10].range returns [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] | |
Object.defineProperty(Array.prototype, "range", { | |
get: function () { | |
var range = [this[0]], i; | |
for (var i = this[0], len = this[1]; i < len; range.push(++i)); | |
return range; | |
} | |
}); | |
// Golfed TypeScript: |
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
<svg class="loader" width="60" height="60" xmlns="http://www.w3.org/2000/svg"> | |
<g> | |
<ellipse ry="25" rx="25" cy="30" cx="30" stroke-width="5" stroke="#000" fill="none"/> | |
</g> | |
</svg> |
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 (url, undefined) { | |
"use strict"; | |
var _params = {}; | |
var _hash = {}; | |
function buildParams(obj) { | |
return Object.keys(obj).length ? | |
"?" + Object.keys(obj).map(function(e) { | |
return encodeURIComponent(e) + "=" + encodeURIComponent(obj[e]); |
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 duplicateElement(element) { | |
var newElement = document.createElement(element.tagName); | |
document.body.appendChild(newElement); | |
var newStyle = window.getComputedStyle(element, null).cssText; | |
var baseProperties = window.getComputedStyle(newElement, null).cssText.split(';').map(function (e) { | |
return e.trim(); | |
}); | |
newElement.innerHTML = element.innerHTML; | |
//Remove styles with default value | |
newElement.style.cssText = newStyle.split(';').map(function (e) { |
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 timeout(func, limit) { | |
var url = URL.createObjectURL(new Blob( | |
['(', func.toString(), ')()'], { | |
type: 'application/javascript' | |
})); | |
worker = new Worker(url); | |
URL.revokeObjectURL(url); | |
setTimeout(function () { |
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
<script type="text/javascript"> | |
/*********************************************** | |
* Javascript Generator Script by PGReviews (Physicsguy's Reviews) | |
* Visit /web/20090808182931/http://www.execulink.com/~kayes/physicsguy/web/ for reviews, guitar tablature, and more! | |
* This notice must stay intact for legal use | |
***********************************************/ | |
function welcome3() |
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 ($) { | |
$.fn.shadow = function () { | |
this.each(function () { | |
var text = this.innerText; | |
this.createShadowRoot() | |
.innerHTML = "<style>:host::after{content:'" + text + "'}</style>"; | |
}); | |
return this; | |
}; |
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 normalize(s) { | |
return s.toLowerCase().replace(/[^a-z]/g, ""); | |
} | |
Object.defineProperty(String.prototype, "isPalindrome", { | |
get: function () { | |
var rev = this.split("").reverse().join(""); | |
return normalize(rev) === normalize(this); | |
} | |
}); |
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 gulp = require("gulp"); | |
var buffer = require("vinyl-buffer"); | |
var source = require("vinyl-source-stream"); | |
var sourcemaps = require("gulp-sourcemaps"); | |
var sass = require("gulp-ruby-sass"); | |
var rename = require("gulp-rename"); | |
var autoprefixer = require("gulp-autoprefixer"); | |
var minifycss = require("gulp-minify-css"); |
OlderNewer