Skip to content

Instantly share code, notes, and snippets.

View hbweb's full-sized avatar
🎯
Focusing

Hung Bui hbweb

🎯
Focusing
View GitHub Profile
@hbweb
hbweb / osx_setup.md
Created October 10, 2020 07:59 — forked from millermedeiros/osx_setup.md
Mac OS X setup

Setup Mac OS X

I've done the same process every couple years since 2013 (Mountain Lion, Mavericks, High Sierra, Catalina) and I updated the Gist each time I've done it.

I kinda regret for not using something like Boxen (or anything similar) to automate the process, but TBH I only actually needed to these steps once every couple years...

/**
* Jest Conversion script
* This script isn't the cleanest, and uses two different methods for performing global replaces... but it gets the job done.
* We switched from using the `replace` method to the `advancedReplace` about 70% of the way through, and couldn't go and retrofit
* `advancedReplace` everywhere with 100% confidence. However, should you use this script as a base for your own migration,
* I would definitely suggest using `advancedReplace`, which uses the node-replace library.
*/
import {sync as globSync} from 'glob'
import {execSync} from 'child_process'
import fs from 'fs'
@hbweb
hbweb / ngrxintro.md
Created August 5, 2019 08:39 — forked from btroncone/ngrxintro.md
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

@hbweb
hbweb / async-validator-wrapper.ts
Created May 9, 2017 08:12 — forked from Humberd/async-validator-wrapper.ts
Async Validator Wrapper for Angular 2 Reactive Forms.This wrapper lets you debounce your asyncValidator instead of on every keystroke
import { AbstractControl } from "@angular/forms";
import { Observable } from "rxjs/Observable";
import { Subject } from "rxjs/Subject";
export class QstAsyncValidatorWrapper {
/*
* Angular async validators are triggered on every key stroke.
* This function debounces triggering an async validator.
*
@hbweb
hbweb / gist:21ec4ba6765e0c4ab2282acde47b9ba3
Created May 12, 2016 11:16 — forked from tonymtz/gist:d75101d9bdf764c890ef
Uninstall nodejs from OSX Yosemite
# first:
lsbom -f -l -s -pf /var/db/receipts/org.nodejs.pkg.bom | while read f; do sudo rm /usr/local/${f}; done
sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /var/db/receipts/org.nodejs.*
# To recap, the best way (I've found) to completely uninstall node + npm is to do the following:
# go to /usr/local/lib and delete any node and node_modules
cd /usr/local/lib
sudo rm -rf node*
@hbweb
hbweb / fix-homebrew-npm.md
Created May 12, 2016 10:31 — forked from DanHerbert/fix-homebrew-npm.md
Instructions on how to fix npm if you've installed Node through Homebrew on Mac OS X or Linuxbrew

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.

Solution

This solution fixes the error caused by trying to run npm update npm -g. Once you're finished, you also won't need to use sudo to install npm modules globally.

Before you start, make a note of any globally installed npm packages. These instructions will have you remove all of those packages. After you're finished you'll need to re-install them.