Skip to content

Instantly share code, notes, and snippets.

View Fallenstedt's full-sized avatar
:octocat:
Having fun

Alexander Fallenstedt Fallenstedt

:octocat:
Having fun
View GitHub Profile
@dews
dews / Limit mac bandwidth.md
Last active February 27, 2024 13:16
Limit mac bandwidth

Mac limit bandwidth

Enable firewall

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

sudo pfctl -e

Example

sudo dnctl pipe 1 config bw 10Kbit/s

@DanHerbert
DanHerbert / fix-homebrew-npm.md
Last active February 12, 2024 17:18
Instructions on how to fix npm if you've installed Node through Homebrew on Mac OS X or Linuxbrew

OBSOLETE

This entire guide is based on an old version of Homebrew/Node and no longer applies. It was only ever intended to fix a specific error message which has since been fixed. I've kept it here for historical purposes, but it should no longer be used. Homebrew maintainers have fixed things and the options mentioned don't exist and won't work.

I still believe it is better to manually install npm separately since having a generic package manager maintain another package manager is a bad idea, but the instructions below don't explain how to do that.

Fixing npm On Mac OS X for Homebrew Users

Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.

@btroncone
btroncone / ngrxintro.md
Last active February 9, 2024 15:37
A Comprehensive Introduction to @ngrx/store - Companion to Egghead.io Series

Comprehensive Introduction to @ngrx/store

By: @BTroncone

Also check out my lesson @ngrx/store in 10 minutes on egghead.io!

Update: Non-middleware examples have been updated to ngrx/store v2. More coming soon!

Table of Contents

@ernsheong
ernsheong / access-mac-localhost-from-parallels-desktop-ie-edge.md
Last active January 24, 2024 00:30
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 0.0.0.0. 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 0.0.0.0. If you use a named domain like domain.local, it has to be defined in /etc/hosts and pointing at 0.0.0.0.

  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 10.211.55.2.

@puranjayjain
puranjayjain / EmittingComponent.js
Created May 24, 2016 04:54
Using fbemitter-https://github.com/facebook/emitter/ (An event emitter) with React + ES6
import React from 'react'
import mrEmitter from '../helpers/mrEmitter'
export default class EmittingComponent extends React.Component {
handleClick = () => {
mrEmitter.emit('onSomeEvent', 'foo sends bar')
}
render() {
@knibals
knibals / redirectExample.go
Created August 16, 2017 09:18 — forked from jaymecd/redirectExample.go
How to redirect HTTP to HTTPS with a golang webserver.
package main
import (
"net/http"
)
func redirect(w http.ResponseWriter, req *http.Request) {
http.Redirect(w, req,
"https://" + req.Host + req.URL.String(),
http.StatusMovedPermanently)
}
@benoitboucart
benoitboucart / gist:f80090c87fa97f4e4098
Last active December 19, 2023 22:14
How to use Jekyll with Gulp
/**
* For more information see this tutorial: http://blog.webbb.be/use-jekyll-with-gulp/
*
* Libs import
* --> How to install? npm install --save-dev gulp-minify-html
* @type {[type]}
*/
var gulp = require('gulp'),
path = require('path'),
@paulallies
paulallies / gist:0052fab554b14bbfa3ef
Last active November 12, 2023 23:00
Remove node_modules from git repo
#add 'node_modules' to .gitignore file
git rm -r --cached node_modules
git commit -m 'Remove the now ignored directory node_modules'
git push origin <branch-name>
@kdrmlhcn
kdrmlhcn / multiple_ssh_setting.md
Last active March 22, 2023 18:43 — forked from jexchan/multiple_ssh_setting.md
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "email@work_mail.com" -f "id_rsa_work_user1"
@gh0st026
gh0st026 / docker_export_postgre_table.sh
Last active February 13, 2023 02:15
Dump PostgreSQL Table in docker container as CSV file
CONTAINER="name"
DB="Db name"
TABLE="Table Name"
FILE="file.csv"
sudo docker exec -u postgres ${CONTAINER} psql -d ${DB} -c "COPY ${TABLE} TO STDOUT WITH CSV HEADER " > ${FILE}