ES proposal:
bound function foo() {
}
foo(); // invalid, cannot be called directly
bar.addEventListener("some", foo); // can be passed as a normal function| class Shuffle { | |
| static shuffle<T>(array: T[]) { | |
| var turns = array.map((value, index) => index); | |
| var result: T[] = []; | |
| for (var i = 0; i < array.length; i++) { | |
| var straw = turns.splice(Math.floor(Math.random() * turns.length), 1)[0]; | |
| result.push(array[straw]); | |
| } | |
| return result; |
| // ==UserScript== | |
| // @name Smarttoon Descroller | |
| // @namespace sn-smartoon-descroller | |
| // @include http://m.comic.naver.com/webtoon/detail.nhn?* | |
| // @version 1.2.0 | |
| // @grant none | |
| // ==/UserScript== | |
| document.addEventListener("DOMContentLoaded", () => { | |
| if (!window.SmarttoonViewer) |
| // ==UserScript== | |
| // @name Konachan | |
| // @namespace sn-konochan-https-imager | |
| // @include https://konachan.com/* | |
| // @version 1.1 | |
| // @grant none | |
| // ==/UserScript== | |
| window.snKonachanStatus = "scriptloaded"; | |
| document.addEventListener("DOMContentLoaded", () => { |
| // Copyright 2011 Google Inc. \ | |
| // \ | |
| // This code is licensed under the same terms as WebM: \ | |
| // Software License Agreement: http://www.webmproject.org/license/software/ \ | |
| // Additional IP Rights Grant: http://www.webmproject.org/license/additional/ \ | |
| // ----------------------------------------------------------------------------- \ | |
| // \ | |
| // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND \ | |
| // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \ | |
| // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \ |
| (function () { | |
| // removeListeners From http://stackoverflow.com/a/18650831 | |
| function removeListeners(el) { | |
| //only replace the ancestor element | |
| var clone = el.cloneNode(false); | |
| //copy children backwards because of the removal | |
| for (var index = el.childNodes.length - 1; index >= 0; --index) | |
| clone.insertBefore(el.childNodes[index], clone.firstChild); |
| # Partly from http://kneppscript.wordpress.com/2011/03/25/encoding-wma-files-using-powershell-and-microsoft-expression-encoder/ | |
| # Depends on FLAC for Windows from Xiph; Expression Encoder 4 SP1 from Microsoft | |
| if ([Environment]::Is64BitProcess) | |
| { | |
| write-warning 'Launching x86 PowerShell' | |
| &"$env:windir\syswow64\windowspowershell\v1.0\powershell.exe" -executionpolicy remotesigned -noninteractive -noprofile -file $myinvocation.Mycommand.path | |
| exit | |
| } |
ES proposal:
bound function foo() {
}
foo(); // invalid, cannot be called directly
bar.addEventListener("some", foo); // can be passed as a normal function