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
// ==UserScript== | |
// @name kfc.de-face | |
// @creator Glenn Dwiyatcita | |
// @namespace https://gist.github.com/dwiyatci | |
// @description A monkey script for halal-ing chickens in KFC Deutschland. Just for fun! No offense to the muslim brotherhood. :'p | |
// @include http://www.kfc.de/faq | |
// @version 1 | |
// @grant none | |
// @require http://code.jquery.com/jquery-latest.min.js | |
// ==/UserScript== |
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
// ==UserScript== | |
// @name anticollision-kletternmonkey | |
// @namespace localhost | |
// @description My take on "#MoneyTree - das Kletterduell" campaign by O2 (May-July 2015). | |
// Just for fun (topping myself in the top ten), and not for | |
// intentionally winning the contest and/or the "Hauptpreis" - | |
// Schwedenreise für zwei im Design-Baumhaus (Gesamtwert 3.000 €). | |
// | |
// This should also be a case study showing how bad it is when a JS | |
// programmer carelessly pollutes the global namespace. =) |
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()%7B(function()%7Bfunction e()%7Bvar e%3Ddocument.createElement("link")%3Be.setAttribute("type","text/css"),e.setAttribute("rel","stylesheet"),e.setAttribute("href",T),e.setAttribute("class",A),document.body.appendChild(e)%7Dfunction t()%7Bfor(var e%3Ddocument.getElementsByClassName(A),t%3D0%3Bt<e.length%3Bt%2B%2B)document.body.removeChild(e%5Bt%5D)%7Dfunction n()%7Bvar e%3Ddocument.createElement("div")%3Be.setAttribute("class",C),document.body.appendChild(e),setTimeout(function()%7Bdocument.body.removeChild(e)%7D,100)%7Dfunction o(e)%7Breturn%7Bheight:e.offsetHeight,width:e.offsetWidth%7D%7Dfunction a(e)%7Bvar t%3Do(e)%3Breturn t.height>p%26%26t.height<b%26%26t.width>w%26%26t.width<v%7Dfunction r(e)%7Bfor(var t%3De,n%3D0%3Bt%3B)n%2B%3Dt.offsetTop,t%3Dt.offsetParent%3Breturn n%7Dfunction i()%7Bvar e%3Ddocument.documentElement%3Breturn window.innerWidth%3Fwindow.innerHeight:e%26%26!isNaN(e.clientHeight)%3Fe.clientHeight:0%7Dfunction s()%7Breturn window.pageYOffset%3Fwindow.pageYOffset: |
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
//////////// constructor pattern | |
function Employee() { | |
this.name = ''; | |
this.salary = 0; // no real encapsulation of private property | |
} | |
// too much code noises and bugs-prone from `prototype` and `this` | |
Employee.prototype.getSalary = 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
function* xcounter() { | |
let index = 0; | |
while (true) { | |
index += 1; | |
const x = yield index; | |
console.log(x); | |
} | |
} | |
const xgen = xcounter(); |
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
jest.useFakeTimers(); | |
const pollingPromise = poll(); | |
const cancelAdvance = advanceTimersContinuously(); | |
const status = await pollingPromise; | |
cancelAdvance(); | |
expect(status).toEqual('COMPLETE'); | |
function advanceTimersContinuously() { |