Skip to content

Instantly share code, notes, and snippets.

View sebald's full-sized avatar
☀️
^⨀ᴥ⨀^

Sebastian Sebald sebald

☀️
^⨀ᴥ⨀^
View GitHub Profile
/**
* Generate type definitions for `material-ui-icons`.
* The generated contens will be written to
* `src/typings/material-ui-icons.d.ts`.
*/
const { parse, resolve } = require('path');
const { EOL } = require('os');
const chalk = require('chalk');
const { writeFile } = require('fs-extra');
const globby = require('globby');
@sebald
sebald / __.md
Last active January 8, 2018 10:52
VSCode extensions + settings

Steps

  1. Copy contents of extensions.txt to your clipboard
  2. pbpaste | xargs -I % code --install-extension %
  3. Done.

Commands

Install list of extensions from clipboard

@sebald
sebald / prepare-commit-msg
Last active April 24, 2017 11:22
Append Jira issue number to every commit
#!/usr/bin/env node
const { exec } = require('child_process');
const { readFile, writeFile } = require('fs');
const { EOL } = require('os');
const CURRENT_BRANCH_JIRA_ISSUE_EXP = /[a-zA-Z]+[-][0-9]+/;
const messageFile = process.argv[2];
/**
* We need the message file to append.
@sebald
sebald / angular.md
Last active January 10, 2017 11:09
Angular vs React

The Good

It's a framework, not a library

"Batteries included": Angular comes with a good some good default libraries, like router, forms and http. These libraries will also always be compatible with the used Angular version, since they share the version and are (mostly) maintained by the Angular coreteam.

Goto CLI/Boilerplate

@sebald
sebald / cross-spawn.js
Last active November 4, 2016 13:34
No graceful error? :(
.then(([{cmd, args}, dependencies]) => {
process.chdir(dir);
return new Promise((resolve, reject) => {
const spinner = ora(chalk.dim('Installing dependencies. This may take a while...')).start();
const stdio = verbose ? 'inherit' : [process.stdin, 'ignore', 'ignore'];
const child = spawn(cmd, args.concat(dependencies), { stdio });
child.on('error', err => reject(err));
child.on('exit', code => {
if (code > 0) {
spinner.text = 'Installation failed!';
@sebald
sebald / extensions.md
Created October 13, 2016 08:36
VSCode Seetings
  • Path Intellisense
  • ESLint
  • TSLint
  • Document This
  • Gutter preview
@sebald
sebald / lowdb-async-store.js
Last active September 9, 2016 13:08
Read async from lowdb
import { exists, readFile, writeFile } from 'graceful-fs';
import { parse } from 'json-parse-helpfulerror';
import fileAsync from 'lowdb/lib/file-async';
/**
* Custom storage for `lowdb`, b/c we want to have read AND
* write to be async. This will make the API more easy to use.
*/
const storage = {
@sebald
sebald / docker.sh
Last active August 19, 2016 13:53
# Remove all stopped containers.
function docker-stop () {
if [[ $(docker ps -a -q) ]]; then
docker rm $(docker ps -a -q)
echo -e "\xf0\x9f\x93\xa6 ➡ \xf0\x9f\x92\xa5 All stoped containers removed!"
else
echo -e "\xf0\x9f\x91\x8c Nothing to stop!"
fi
}
this.state$ = Observable
.create((observer:any) => {
this.store.subscribe(() => observer.next(this.store.getState()));
})
.startWith(this.store.getState());