Skip to content

Instantly share code, notes, and snippets.

Having fun

Alexander Fallenstedt Fallenstedt

Having fun
View GitHub Profile

Keybase proof

I hereby claim:

  • I am fallenstedt on github.
  • I am fallenstedt ( on keybase.
  • I have a public key ASC9XKEzj4DsJZDXNeszL8jAlaLxCHhC1esNgTCRlTXaUQo

To claim this, I am signing this object:

gh0st026 /
Last active Jun 23, 2021
Dump PostgreSQL Table in docker container as CSV file
DB="Db name"
TABLE="Table Name"
sudo docker exec -u postgres ${CONTAINER} psql -d ${DB} -c "COPY ${TABLE} TO STDOUT WITH CSV HEADER " > ${FILE}
DomiR / observable-queue.ts
Created Mar 11, 2018 — forked from evxn/observable-queue.ts
Add Observable-like entities to a queue (Promises, Observables, Subjects, Arrays, generators, Iterables). After each stream is completed (i.e. Promise resolved) it's elements are emitted to the result stream in the order of addition (first in first out). Each subscriber receives result only for items added to queue after the subscription.
View observable-queue.ts
import {Subject} from 'rxjs/Subject';
import {BehaviorSubject} from 'rxjs/BehaviorSubject';
import {Observable, ObservableInput} from 'rxjs/Observable';
import {concatMap, switchMap} from 'rxjs/operators';
enum QueueActions {
ADD = 'ADD',
phuochau / sample_configuration.js
Last active Mar 26, 2018
Sample configuration for using Jest and vue-test-utils in nuxt.js project
View sample_configuration.js
// package.json
"jest": {
"roots": [
"moduleNameMapper": {
"[\\s\\S]*.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/tests/unit/__mocks__/fileMock.js",
"[\\s\\S]*.(css|less)$": "<rootDir>/tests/unit/__mocks__/styleMock.js",
"~/([a-zA-Z0-9/.\\-_]*)": "<rootDir>/src/$1"
ernsheong /
Last active Jul 14, 2021
Accessing macOS localhost from Parallels Desktop IE or Edge

Access macOS localhost from IE or Edge within Parallels Desktop

This issue is so infuriating that I'm going to take some time to write about it.

  1. MOST IMPORTANT. Your local development server must be bound to IP address Some do this by default, but many don't. You need to make sure that you run your local server with correct IP bindings. You may need to provide additional flags to your serve commands e.g. polymer serve --hostname domain.local, hugo serve --bind If you use a named domain like domain.local, it has to be defined in /etc/hosts and pointing at

  2. My Parallels setting is using Shared Network, nothing special there.

  3. Open macOS Terminal and type ifconfig. Look for the value under vnic0 > inet. It is typically

brien-crean / twitter_oauth_user_context.js
Created Jul 14, 2017
Twitter 3 legged OAuth on AWS Lambda with NodeJS
View twitter_oauth_user_context.js
const OAuth = require('oauth');
const Twit = require('twit');
const nconf = require('nconf');
// temp global var
var oAuthTokenSecret;
// load config file which contains twitter app tokens
nconf.file({ file: './config/twitter-share.json' }).env()
View random_image_generator.exs
defmodule Image do
defstruct [:grid, :pixel_map]
defmodule RandomImageGenerator do
def create(width, bar_size, filename \\ "out.png") do
|> create_grid(width)
|> build_pixel_map(width, bar_size)
dews / Limit mac
Last active Jul 12, 2021
Limit mac bandwidth
View Limit mac

Mac limit bandwidth

Enable firewall

Apple menu -> System Preferences -> Security & Privacy -> Firewall

sudo pfctl -e


sudo dnctl pipe 1 config bw 10Kbit/s
View EmittingComponent.js
import React from 'react'
import mrEmitter from '../helpers/mrEmitter'
export default class EmittingComponent extends React.Component {
handleClick = () => {
mrEmitter.emit('onSomeEvent', 'foo sends bar')
render() {
vespertilian / conditional_effects.ts
Created Feb 9, 2017
Two options for conditional ngrx effects
View conditional_effects.ts
selectAndLoadStore$: Observable<Action> = this.actions$
.map(([action, storeState]) => [action.payload, storeState])
.switchMap(([storeName, storeState]) => {
const existsInStore = Boolean(storeState.urlNameMap[storeName]);
return Observable.if(
() => existsInStore,
Observable.of(new storeActions.SetSelectedStore(storeName)),