Skip to content

Instantly share code, notes, and snippets.

View wlib's full-sized avatar
🔙
delete all code

Daniel Ethridge wlib

🔙
delete all code
View GitHub Profile
@wlib
wlib / curry.js
Last active December 10, 2018 18:29
curry a js function
function _isPlaceholder(a) {
return a != null &&
typeof a === 'object' &&
a['@@functional/placeholder'] === true;
}
function _arity(n, fn) {
/* eslint-disable no-unused-vars */
switch (n) {
case 0: return function() { return fn.apply(this, arguments); };
javascript:fetch(`https://create.kahoot.it/rest/kahoots/${prompt("Paste the Kahoot ID")}/card/?includeKahoot=true`).then(res=>res.json()).then(json=>json.kahoot.questions.map((q,number)=>{const{choices}=q;for(let i=0;i<choices.length;i+=1){if(choices[i].correct){switch(i){case 0:return `Q${number+1}: red triangle - ${choices[i].answer }`;break;case 1:return `Q${number+1}: blue diamond - ${choices[i].answer }`;break;case 2:return `Q${number+1}: yellow circle - ${choices[i].answer }`;break;case 3:return `Q${number+1}: green square - ${choices[i].answer }`;break}}}}).join("\n")).then(answers=>open().document.body.innerText=answers);
function getWidgetURL(options) {
const url = new URL("https://s.tradingview.com/widgetembed/");
const defaultOptions = {
symbol: "BTCUSD",
interval: 60,
hidesidetoolbar: 0,
symboledit: 1,
saveimage: 1,
toolbarbg: "f1f3f6",
theme: "Light",
<html>
<head>
<title>Close Me</title>
</head>
<body>
<script>
const symbols = location.search.slice(1).split(",");
symbols.forEach(symbol => open(`https://s.tradingview.com/widgetembed/?symbol=${symbol}&interval=60&hidesidetoolbar=0&symboledit=1&saveimage=1&toolbarbg=f1f3f6&theme=Light&style=1&timezone=America%2FNew_York&locale=en`));
</script>
<html>
<head>
<title>Close Me</title>
</head>
<body>
<script>
const symbols = location.search.slice(1).split(",");
symbols.forEach(symbol => {
const w = open(`https://s.tradingview.com/widgetembed/?symbol=${symbol}&interval=60&hidesidetoolbar=0&symboledit=1&saveimage=1&toolbarbg=f1f3f6&theme=Light&style=1&timezone=America%2FNew_York&locale=en`);
<embed
id="player"
name="flash_object_embed"
src=""
width="100%" height="100%"
type="application/x-shockwave-flash"
allowscriptaccess="always"
align="middle"
allownetworking="internal"
wmode="direct"
<a href="javascript:(function(){if(document.body.contentEditable==='true'){document.body.contentEditable='false';}else{document.body.contentEditable='true';}})();">Edit this</a>
<br>
<a href="javascript:(function(){regex=/\/(edit|view)/;path=location.pathname;if(regex.test(path))location.pathname=path.replace(regex, '/preview');})();">Preview google drive</a>
<br>
<a href="javascript:(function(){Runner.instance_.loadImages();style=document.createElement('style');document.head.appendChild(style);style.sheet.insertRule('.snackbar-show { animation: unset }');})();">Unblock chrome://dino</a>
<br>
<a href="javascript:(function(){editor=document.querySelector('div.commit-create > div.CodeMirror');editor.setAttribute('style'%2C'height%3A50%25');})();">Enlarge gist edit window</a>
<br>
<a href="javascript:Array.from(document.querySelectorAll('.tv-dialog__modal-wrap, .tv-dialog__overlay')).forEach(e => e.remove());">Clean tradingview</a>
<br>
function finance_demo(container) {
const { price, summaryTicks, volume } = financeData;
const options = {
container,
data: {
price,
summary: price,
volume
},
trackFormatter(o) {
<body>
<script>
eval(location.hash.slice(1));
</script>
</body>
<html>
<head>
<title>Zalgo Generator</title>
<script src="./zalgo.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.5.2/css/bulma.min.css" rel="stylesheet" type="text/css">
</head>
<body>
<section class="hero is-info is-fullheight is-bold">
<section class="section">