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
window.jQuery = elem => new jQueryClass(elem); | |
window.$ = window.jQuery; | |
class jQueryClass { | |
constructor(selector) { | |
if (selector instanceof jQueryClass) return selector; | |
else if (selector instanceof Function) $(document).ready(selector); | |
else if (selector instanceof NodeList) this.elements = selector; | |
else if (selector instanceof HTMLElement) this.elements = [selector]; | |
else if (Object.is(selector, document)) this.elements = [document]; |
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
// run in console window on bugs.mojang.com/404 | |
const SEARCH = 'https://bugs.mojang.com/rest/api/2/search?jql=' | |
const encode = encodeURIComponent | |
let dumpedData = []; | |
const getData = () => console.log(JSON.stringify(dumpedData)) | |
async function fetchComments({ query, max = 1000 }) { | |
let count = 0, batch = 1; | |
dumpedData.push({ _meta: { query, max } }) |
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
#!/usr/bin/env ruby | |
require 'digest' | |
language = 'InsertLangHere' # replace with full lang name | |
id = Digest::SHA256.hexdigest(language).to_i(16) % (2**30 - 1) | |
puts id |
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 test(n) { | |
let list = []; | |
function iterate(n) { | |
list.push(n); | |
return n <= 1 ? 1 : iterate(n % 2 === 0 ? n / 2 : 3 * n + 1); | |
} | |
iterate(n); | |
return list; | |
} |
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 encode(Type, str) { | |
const encodedString = str.split('').map(c => c.charCodeAt(0)); | |
return Type.from(encodedString); | |
} | |
encode(Int8Array, 'abcdef'); |
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
Show hidden characters
// source: https://github.com/aschoettler/misc-stuff/blob/349b824d321f15286f6af3478bc52a1eeaa10770/github-light.map.json | |
{ | |
"comment": "pl-c", | |
"punctuation.definition.comment": "pl-c", | |
"string.comment": "pl-c", | |
"constant": "pl-c1", | |
"entity.name.constant": "pl-c1", | |
"markup.raw": "pl-c1", | |
"meta.diff.header": "pl-c1", | |
"meta.module-reference": "pl-c1", |
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
export default const escapeRegex = (str: string): string => str.replace(/[.*+?^/${}()|[\]\\]/g, '\\$&'); |
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 arr = [] | |
if (arr == !arr) throw 'wtf' |
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:(()=>{ | |
/* | |
save this as a bookmark | |
run on https://github-lightshow.herokuapp.com | |
*/ | |
document.head.innerHTML += `<style> | |
.code{background-color:#fff;color:#333;font-family:Consolas, 'Liberation Mono', Menlo, Courier, monospace;font-size:12px} | |
[class*="pl-"] {color: white !important;} |
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
# In RStudio, Ctrl+A then Run | |
library(ggplot2) | |
library(dplyr) | |
library(svglite) | |
setwd("xxxxx") # replace with own working directory | |
# Read data | |
csvData <- read.csv("poll-data.csv") |