Skip to content

Instantly share code, notes, and snippets.

@cdolek
cdolek / gist:198adb54ca7885d481144dfe51eec028
Created August 15, 2022 22:57
Percentage to hex map for 8 digit hex color alpha values
100% — FF
99% — FC
98% — FA
97% — F7
96% — F5
95% — F2
94% — F0
93% — ED
92% — EB
91% — E8
@cdolek
cdolek / gist:b87af01c94dd49d780806d7f07e460a5
Created August 15, 2022 19:45
Monaco editor theme colors
{
"foreground": {
"type": "string",
"description": "Overall foreground color. This color is only used if not overridden by a component.",
"format": "color-hex",
"defaultSnippets": [
{
"body": "${1:#ff0000}"
}
]
{
"orange": {
"hex": "#E69F00",
"hue": 41,
"hsl": "hsl(41, 100%, 45%)"
},
"sky blue": {
"hex": "#56B4E9",
"hue": 202,
"hsl": "hsl(202, 77%, 63%)"
@cdolek
cdolek / Tiny JavaScript tokenizer.js
Created January 22, 2021 06:13 — forked from borgar/Tiny JavaScript tokenizer.js
A compact tokenizer written in JavaScript.
/*
* Tiny tokenizer
*
* - Accepts a subject string and an object of regular expressions for parsing
* - Returns an array of token objects
*
* tokenize('this is text.', { word:/\w+/, whitespace:/\s+/, punctuation:/[^\w\s]/ }, 'invalid');
* result => [{ token="this", type="word" },{ token=" ", type="whitespace" }, Object { token="is", type="word" }, ... ]
*
*/

Oh my zsh.

Install with curl

sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

Enabling Plugins (zsh-autosuggestions & zsh-syntax-highlighting)

  • Download zsh-autosuggestions by
@cdolek
cdolek / gist:3b092e1559409a87e6e84bb50ad11bf1
Created June 30, 2018 22:53
Meteor multiple functions & future(s) result
const range = [
future => {
Meteor.setTimeout(() => {
future.return(1000);
}, 1000);
},
future => {
Meteor.setTimeout(() => {
future.return(2000);
}, 2000);
@cdolek
cdolek / gist:244aabc843cefb3517c28e70d1fa8c12
Last active April 10, 2018 15:50
replacing value of a column in a csv file
# Here we replace col 4 with the value of 1
awk -F, '{$4="1";}1' OFS=, my.csv
@cdolek
cdolek / gensim_ldamulticore_error.txt
Last active December 22, 2017 12:23
Python v3.6.4 - LdaMulticore crash
lda = LdaMulticore(trigram_bow_corpus,
num_topics=num_topics,
workers=2,
id2word=trigram_dictionary,
chunksize=10000,
passes=passes)
----------------------------------------------------------------------------------------------------------------------------
2017-12-22 07:17:25,366 : INFO : loading Dictionary object from ./data/data_output/trigram_dict_all.dict
@cdolek
cdolek / package.json
Created November 1, 2017 02:49
Meteor eslintConfig
"eslintConfig": {
"parserOptions": {
"ecmaFeatures": {
"jsx": true
}
},
"plugins": ["meteor", "react"],
"extends": [
"airbnb",
"plugin:meteor/recommended",