Skip to content

Instantly share code, notes, and snippets.

@raine
raine / consoleLogWithBoldTags.js
Created Jul 23, 2020
Quick and dirty way to log html tag in browser console.log with bold style
View consoleLogWithBoldTags.js
function consoleLogWithBoldTags(str: string) {
const openTag = /(<[a-z]+?>)/g
const closeTag = /(<\/[a-z]+?>)/g
const parts = str
.replace(openTag, '|||$1')
.replace(closeTag, '$1|||')
.split('|||')
.filter((p) => p !== ' ')
console.log(
@raine
raine / style.css
Last active Mar 6, 2020
Escape from Tarkov Wiki Fullscreen Customs Interactive Map
View style.css
/*
* Add this custom style on the page https://escapefromtarkov.gamepedia.com/Customs_Interactive_Map
* with extension like Stylus to remove all the clutter and view map in fullscreen.
*/
.mw-body-content {
z-index: initial;
}
#map {
visibility: visible;
View config.ts
function getFromEnv(prop: string): string {
const val = process.env[prop]
if (val) {
return val
} else {
throw new Error(`Expected ${prop} to exist in env`)
}
}
type Config = {
View run
#!/usr/bin/env bash
set -euo pipefail
murobbs() {
curl -s 'https://murobbs.muropaketti.com/forums/naeytoet-tulostimet-ja-muut-lisaelaitteet.207/index.rss?prefix_id=8' |\
xml2json |\
ramda '.rss.channel.item' 'project [\title, \pubDate, \link]' 'map assoc \source \murobbs'
}
View run.sh
#!/usr/bin/env bash
set -euo pipefail
murobbs() {
curl -s 'https://murobbs.muropaketti.com/forums/naeytoet-tulostimet-ja-muut-lisaelaitteet.207/index.rss?prefix_id=8' |\
xml2json |\
ramda '.rss.channel.item' 'project [\title, \pubDate, \link]' 'map assoc \source \murobbs'
}
View make-table.sh
#!/usr/bin/env bash
curl -s https://restcountries.eu/rest/v2/all | \
html-table -o \
--cols flag,code,name,population,area,capital,tld,languages \
--col.flag.cell '<div style="text-align: center"><img src="${flag}" height="20" /></div>' \
--col.flag.header '' \
--col.flag.width 50 \
--col.code.width 40 \
--col.code.cell '${alpha2Code}' \
View test.md

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

View frame-size.ne
@{% function nuller() { return null; } %}
@{% function joiner(d) { return d.join(''); } %}
@{% const R = require('ramda'); %}
main -> any frame_size_candidate _ any {% R.nth(1) %}
frame_size_candidate ->
frame_size_prefix _ ":":? _ frame_size {% R.last %}
| frame_size_tshirt "-size"i {% R.head %}
| frame_size_tshirt _ "koko"i {% R.head %}
View index.js
const params = U.view(['search', searchParamsL], location)
const search = U.atom(params.get().search || '')
const debouncedSearch = U.debounce(300, search)
debouncedSearch
.onValue(q => params.modify(
q ? R.assoc('search', q) : R.dissoc('search')
))
const items = U.thru(
debouncedSearch,
View ch9-exercise.hs
split :: Char -> String -> (String, String)
split c str = (start, rest)
where start = takeWhile (/= c) str
rest = dropWhile (== c) $ dropWhile (/= c) str
myWords :: String -> [String]
myWords [] = []
myWords str = start : (myWords rest)
where (start, rest) = split ' ' str
You can’t perform that action at this time.