Skip to content

Instantly share code, notes, and snippets.

View senhongo's full-sized avatar
🏂
winter is coming

Sen senhongo

🏂
winter is coming
View GitHub Profile
@senhongo
senhongo / accounting.sql
Created November 10, 2019 09:27 — forked from 001101/accounting.sql
Basic double-entry bookkeeping system, for PostgreSQL.
CREATE TABLE accounts(
id serial PRIMARY KEY,
name VARCHAR(256) NOT NULL
);
CREATE TABLE entries(
id serial PRIMARY KEY,
description VARCHAR(1024) NOT NULL,
amount NUMERIC(20, 2) NOT NULL CHECK (amount > 0.0),
-- Every entry is a credit to one account...

macOS 10.12 Sierra Setup

Custom recipe to get macOS 10.12 Sierra running from scratch, setup applications and developer environment. This is very similar (and currently mostly the same) as my 10.11 El Capitan setup recipe and 10.10 Yosemite setup recipe. I am currently tweaking this for 10.12 Sierra and expect to refine this gist over the next few weeks.

I use this gist to keep track of the important software and steps required to have a functioning system after a semi-annual fresh install. I generally reinstall each computer from scratch every 6 months, and I do not perform upgrades between releases.

This keeps the system performing at top speeds, clean of trojans, spyware, and ensures that I maintain good organizational practices for my content and backups. I highly recommend this.

You are encouraged to fork this and modify it to your heart's content to match your o

@senhongo
senhongo / mini-redux.js
Created April 22, 2017 13:47 — forked from MarcoWorms/mini-redux.js
Redux in a nutshell
function createStore (reducers) {
var state = reducers()
const store = {
dispatch: (action) => {
state = reducers(state, action)
},
getState: () => {
return state
}
}
@senhongo
senhongo / postgres-cheatsheet.md
Created April 19, 2017 03:02 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

If run with -E flag, it will describe the underlaying queries of the \ commands (cool for learning!).

Most \d commands support additional param of __schema__.name__ and accept wildcards like *.*

@senhongo
senhongo / index.js
Created January 26, 2017 13:58 — forked from just-boris/index.js
Gulp wrap pipe
/**
* Wrap gulp streams into fail-safe function for better error reporting
* Usage:
* gulp.task('less', wrapPipe(function(success, error) {
* return gulp.src('less/*.less')
* .pipe(less().on('error', error))
* .pipe(gulp.dest('app/css'));
* }));
*/
@senhongo
senhongo / exampleComponent.ts
Created December 9, 2016 17:37 — forked from squadwuschel/exampleComponent.ts
Example Angular 1.5 Component in TypeScript
module App.Components {
/*
* Beschreibung ...
*
* Verwendung:
*
* <edit-user-cmp name="ctrl.name" test="ctrl.blubb></edit-user-cmp>
*/
export class EditUserCmp implements ng.IComponentOptions {
@senhongo
senhongo / auto-deploy.md
Created November 25, 2016 18:12 — forked from domenic/0-github-actions.md
Auto-deploying built products to gh-pages with Travis

Auto-deploying built products to gh-pages with Travis

This is a set up for projects which want to check in only their source files, but have their gh-pages branch automatically updated with some compiled output every time they push.

Create a compile script

You want a script that does a local compile to e.g. an out/ directory. Let's call this compile.sh for our purposes, but for your project it might be npm build or gulp make-docs or anything similar.

The out/ directory should contain everything you want deployed to gh-pages. That almost always includes an index.html.

@senhongo
senhongo / upgrade.md
Created October 19, 2016 08:29
reinstall global packages after upgrading Node.js using nvm

nvm reinstall-packages v6.3

Above code reinstalls all global packages from v6.3 into whatever is the current version.

@senhongo
senhongo / introrx.md
Created August 18, 2016 00:18 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@senhongo
senhongo / sequelpro.md
Last active March 4, 2016 05:27
Sequel Pro causing macbook to overheat and how I solved it.

Sequel Pro caused my macbook to overheat and how I solved it.

the situation

Sequel Pro seemed to take longer than usual to start up. Did not mind at first.
Did some simple house keeping, adding and updating files through the wysiwyg editor.
Later, tried to run a simple query

update {table} set {col} = 'value';