Skip to content

Instantly share code, notes, and snippets.

View SleeplessByte's full-sized avatar
💎
💎 💎 💎

Derk-Jan Karrenbeld SleeplessByte

💎
💎 💎 💎
View GitHub Profile
@SleeplessByte
SleeplessByte / forward.sh
Last active April 12, 2020 01:23
Shell: forward arguments
#!/usr/bin/env bash
# Documentation on @
# https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#index-_0040
# Documentation on shift [n]
# https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#index-shift
# Why quoting the argument is "necessary":
# https://stackoverflow.com/questions/4824590/propagate-all-arguments-in-a-bash-shell-script/4824637#4824637
# eats 1 argument
… (input = "you")  
  paste0("One for ", input, ", one for me.")
@SleeplessByte
SleeplessByte / package.json
Created April 25, 2017 00:43
react-fluffy package.json
{
"name": "react-fluffy",
"version": "1.0.0",
"description": "Shuffle Puzzle Game with React",
"main": "webpack.config.babel.js",
"scripts": {
"clean": "rimraf dist",
"lint": "eslint src",
"lint:fix": "yarn run lint -- --fix",
"prestart": "yarn run clean && yarn run build",
// Start by determining the build environment. The three main options are:
// - development (__DEV__): for development builds
// - test: (__TEST__): for running and developing tests
// - production: (__PROD__) for staging and production builds
//
// Additionally coverage and cli can be turned on changing the arguments passed in
const ENV = process.env.NODE_ENV || 'development'
const __PROD__ = ENV === 'production'
@SleeplessByte
SleeplessByte / .eslintrc
Created April 24, 2017 21:41
Default eslint to work with code climate
{
/*
Code Climate Supports (level 3)
===============================
babel-eslint
*/
"parser": "babel-eslint",
/*
@SleeplessByte
SleeplessByte / tsconfig.json
Created April 24, 2017 21:39
Default tsconfig.json
{
"compilerOptions": {
"allowJs": false,
"allowSyntheticDefaultImports": false,
"allowUnreachableCode": false,
"allowUnusedLabels": false,
"alwaysStrict": true,
"baseUrl": "./src",
@SleeplessByte
SleeplessByte / tslint.json
Last active April 24, 2017 21:38
Default tslint
{
"rulesDirectory": [
],
"rules": {
"adjacent-overload-signatures": true,
"member-access": false,
"member-ordering": [
true,
{ "order": [
@SleeplessByte
SleeplessByte / preact-bootstrap-with-sass.md
Last active September 5, 2018 00:38
Preact Bootstrap modifications to use sass / scss

Preact-Bootstrap with scss

To switch from less to sass / scss take the following steps:

1. Install sass loader

npm install sass-loader node-sass --save-dev
npm uninstall less-loader --save-dev

2. Rename .less to .scss

/**
* Setups an autocomplete subscription
*
* @template T
* @param {Observable<string>} input$ stream of autocomplete-values
* @param {HTMLInputElement} input the input source
* @param {Element} startBtn the element to start a query manually
* @param {Element} cancelBtn the element to end any query
* @param {(value: T) => void} notifier that there is a definitive value
* @param {(q: string) => Observable<T>} doQuery returns observable doing the query
/*!
* jQuery throttle / debounce - v1.1 - 3/7/2010
* http://benalman.com/projects/jquery-throttle-debounce-plugin/
*
* Copyright (c) 2010 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*/
// Script: jQuery throttle / debounce: Sometimes, less is more!