Skip to content

Instantly share code, notes, and snippets.

View skoshy's full-sized avatar
🙃
Probably starting a new side project

Stefan K skoshy

🙃
Probably starting a new side project
View GitHub Profile
@skoshy
skoshy / GM_fetch.js
Last active May 3, 2021 05:18
GM_fetch
/***********
This is not a 100% 1:1 mapping to fetch,
but it works good enough for most use cases!
How to use:
Just copy and paste this function into your Userscript.
Then, call it as you would normal `fetch`.
************/
async function GM_fetch(url, options = {}) {
@skoshy
skoshy / run_on_page.js
Last active January 25, 2020 08:18
Generate Tailwind CSS Color Variables / Config
/* Run this in the console on https://tailwindcss.com/docs/customizing-colors/ */
toRRGGBBAASuffix = (num) => (num).toString(16).padEnd(4, 0).substr(2,2)
opacities = [0.2, 0.4, 0.6, 0.8];
additionalColors = [
['black', '#000000'],
['white', '#ffffff'],
];
lines = '';
@skoshy
skoshy / delayFunc.js
Last active July 30, 2019 16:59
Allows you to delay execution of a function, very useful when console debugging
delayFunc = (func, {name = Date.now(), duration = 5000, interval = 1000} = {}) => {
let logger = (str) => console.log(`[${name}] ${str}`);
let iterationCount = 0;
let timer = setInterval(() => {
iterationCount++;
let finished = iterationCount * interval >= duration;
logger(`${iterationCount} / ${duration / interval}${finished ? ', Finished!' : ''}`);
if (finished) {
@skoshy
skoshy / parsingint.csv
Last active June 6, 2019 17:48
Different ways of parsing an integer in JavaScript
Input parseInt(i) || 0 +i || 0 i | 0 Notes
'1' 1 1 1
'4s' 4 0 0
'45734584574354954345444533544354353' 4.573458457435495e+34 4.573458457435495e+34 0
@skoshy
skoshy / .eslintrc.yml
Last active August 27, 2018 22:03
Default ESLint Config
env:
node: true # this is the best starting point
browser: true # for react web
es6: true # enables es6 features
parser: "babel-eslint" # needed to make babel stuff work properly
parserOptions:
ecmaVersion: 6
sourceType: module
ecmaFeatures:
jsx: true
@skoshy
skoshy / .gitconfig
Last active August 26, 2018 13:58
My Git Config
[core]
autocrlf = false
eol = lf
[user]
email = noreply@skoshy.com
name = Stefan Koshy
[alias]
# Thanks to https://gist.github.com/robmiller/6018582 for many of these
# Basic
@skoshy
skoshy / profile.ps1
Last active September 18, 2018 05:31
PowerShell Profile
# Makes Powershell tab completion work like Bash
Set-PSReadlineKeyHandler -Key Tab -Function MenuComplete
# Imports posh-git
Import-Module posh-git
$GitPromptSettings.DefaultPromptPrefix.Text = '$(Get-Date -f "MM-dd HH:mm:ss") '
$GitPromptSettings.DefaultPromptPrefix.ForegroundColor = 0x3891b7
$GitPromptSettings.DefaultPromptAbbreviateHomeDirectory = $true
#####
# Remember to `brew install reattach-to-user-namespace` for working copy support
# Also install tpm - git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
# and then install tpm plugins - https://github.com/tmux-plugins/tpm#installing-plugins
#####
# Plugins
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'

Keybase proof

I hereby claim:

  • I am skoshy on github.
  • I am skoshy (https://keybase.io/skoshy) on keybase.
  • I have a public key ASBtmxmQjuASNdVEtNxQu39RyWhi8uqCUXgxe7rGi4Gi2go

To claim this, I am signing this object:

@skoshy
skoshy / .treehouse
Last active August 1, 2017 19:08 — forked from ErikGartner/.treehouse
dTree Demo
1.3.1