Skip to content

Instantly share code, notes, and snippets.

View vlrmprjct's full-sized avatar
🎹
Boing boom tschak!

Thomas vlrmprjct

🎹
Boing boom tschak!
View GitHub Profile
@vlrmprjct
vlrmprjct / react.js
Created June 12, 2020 03:28
ReactJS multiple optional params
<Route path="/section/(page)?/:page?/(sort)?/:sort?" component={Section} />
@vlrmprjct
vlrmprjct / dt37sdm-attiny84.ino
Last active July 26, 2020 11:29
Damn tiny 3x7 segment display module
// ATMEL ATTINY84
// +-\/-+
// VCC 1| |14 GND
// (D10) PB0 2|x |13 AREF (D 0)
// (D 9) PB1 3|x |12 PA1 (D 1)
// PB3 4| |11 PA2 (D 2)
// PWM INT0 (D 8) PB2 5|x |10 PA3 (D 3)
// PWM (D 7) PA7 6| |9 PA4 (D 4)
// PWM (D 6) PA6 7| |8 PA5 (D 5) PWM
//
@vlrmprjct
vlrmprjct / webpack.config.dev.js
Created May 3, 2020 07:17 — forked from oreofeolurin/webpack.config.dev.js
Webpack file for configuring SCSS with React (create-react-app)
'use strict';
const autoprefixer = require('autoprefixer');
const path = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin');
const InterpolateHtmlPlugin = require('react-dev-utils/InterpolateHtmlPlugin');
const WatchMissingNodeModulesPlugin = require('react-dev-utils/WatchMissingNodeModulesPlugin');
const eslintFormatter = require('react-dev-utils/eslintFormatter');
@vlrmprjct
vlrmprjct / array_iteration_thoughts.md
Created January 25, 2020 08:09 — forked from ljharb/array_iteration_thoughts.md
Array iteration methods summarized

While attempting to explain JavaScript's reduce method on arrays, conceptually, I came up with the following - hopefully it's helpful; happy to tweak it if anyone has suggestions.

Intro

JavaScript Arrays have lots of built in methods on their prototype. Some of them mutate - ie, they change the underlying array in-place. Luckily, most of them do not - they instead return an entirely distinct array. Since arrays are conceptually a contiguous list of items, it helps code clarity and maintainability a lot to be able to operate on them in a "functional" way. (I'll also insist on referring to an array as a "list" - although in some languages, List is a native data type, in JS and this post, I'm referring to the concept. Everywhere I use the word "list" you can assume I'm talking about a JS Array) This means, to perform a single operation on the list as a whole ("atomically"), and to return a new list - thus making it much simpler to think about both the old list and the new one, what they contain, and

@vlrmprjct
vlrmprjct / gitkraken-wsl-bash.bat
Created January 16, 2020 15:17 — forked from carlolars/gitkraken-wsl-bash.bat
Use bash from WSL as sh.exe for GitKraken (5.0.4) for Windows
@echo off
REM Make sure that the path to the script is correct!
@bash -l -c "~/bin/gitkraken-wsl-bash.sh %*"
@vlrmprjct
vlrmprjct / launch.json
Last active April 6, 2020 09:18
VSCode debug configuration using wsl and microsoft edge ( canary ) #vscode #debug #wsl #edge #reactjs #linux #chrome #chromium #sourcemaps
{
// https://go.microsoft.com/fwlink/?linkid=830387
// https://code.visualstudio.com/docs/editor/variables-reference
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Edge",
"runtimeExecutable": "C:/Users/USERNAME/AppData/Local/Microsoft/Edge SxS/Application/msedge.exe",
@vlrmprjct
vlrmprjct / .gitconfig
Created March 27, 2019 14:46 — forked from pksunkara/config
Sample of git config file (Example .gitconfig)
[user]
name = Pavan Kumar Sunkara
email = pavan.sss1991@gmail.com
username = pksunkara
[core]
editor = vim
whitespace = fix,-indent-with-non-tab,trailing-space,cr-at-eol
excludesfile = ~/.gitignore
[sendemail]
smtpencryption = tls
@vlrmprjct
vlrmprjct / wsl.sh
Last active March 16, 2019 17:04
WSL
sudo apt-get update
// NODE JS
curl -sL https://deb.nodesource.com/setup_11.x | sudo -E bash -
sudo apt-get install -y nodejs
// NPM
sudo apt-get install npm
// or
sudo curl https://www.npmjs.com/install.sh | sh
@vlrmprjct
vlrmprjct / countdown.js
Created November 29, 2018 12:35
countdown from seconds #time #js
export const countdown = (function () {
const pad = t => {
return (t + '').length < 2 ? pad('0' + t + '') : t;
}
return s => {
const d = Math.floor(s / (3600 * 24));
s -= d * 3600 * 24;
const h = Math.floor(s / 3600);
s -= h * 3600;
@vlrmprjct
vlrmprjct / .editorconfig
Created October 15, 2018 07:12
editorconfig #editorconfig #indention #code
root = true
[*]
charset = utf-8
end_of_line = lf
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
[*.{js,jsx,ts,tsx,vue,json}]