Skip to content

Instantly share code, notes, and snippets.

@guyjin
guyjin / npm_scripts_build_tool.md
Created December 1, 2023 20:06 — forked from lukewang1024/npm_scripts_build_tool.md
Notes from egghead.io course: How to Use npm Scripts as Your Build Tool

Use npm scripts as your build tool

Basic dev task composition

// Dev tasks
{
  "scripts": {
    "eslint": "eslint --cache --fix ./",
    "stylelint": "stylelint '**/*.scss' --syntax scss",
@guyjin
guyjin / top-brew-packages.txt
Created August 17, 2022 13:55 — forked from pmkay/top-brew-packages.txt
Top homebrew packages
node: Platform built on V8 to build network applications
git: Distributed revision control system
wget: Internet file retriever
yarn: JavaScript package manager
python3: Interpreted, interactive, object-oriented programming language
coreutils: GNU File, Shell, and Text utilities
pkg-config: Manage compile and link flags for libraries
chromedriver: Tool for automated testing of webapps across many browsers
awscli: Official Amazon AWS command-line interface
automake: Tool for generating GNU Standards-compliant Makefiles
@guyjin
guyjin / JS-One-Liners
Last active May 6, 2024 11:18
JS One-liner collection
just a collection of js one-liners from around the web.
@guyjin
guyjin / machine.js
Created November 23, 2020 20:32
Generated by XState Viz: https://xstate.js.org/viz
const jobsMachineConfig = Machine({
id: "jobsAdmin",
initial: "loading",
context: {
jobs: [],
jobCategory: "All",
jobPolling: true,
selectedJob: undefined,
error: undefined,
},
@guyjin
guyjin / machine.js
Last active May 6, 2024 11:22
Generated by XState Viz: https://xstate.js.org/viz
const jobsMachineConfig = Machine({
id: "jobsAdmin",
initial: "loading",
context: {
jobs: undefined,
selectedJob: undefined,
error: undefined,
},
states: {
loading: {
@guyjin
guyjin / A.markdown
Created October 21, 2020 00:44 — forked from erickeno/A.markdown
XState + AWS Amplify example

XState + AWS Amplify example

A breakdown of a project that uses XState to manage state for authenticating a user with Cognito, and then finding the authorized application user with an invoked machine.

  1. create auth machine
  2. create auth context
  3. handle AWS authentication
  4. once user authenticates with Cognito, redirect to user route to get user from db
  5. at user route use userMachine service from authMachine to get application user
  6. once associated application user is found, send user to organization route to allow user to associate session with specific organization
@guyjin
guyjin / gist:037d4b7061ac186d552fe6215a197eb5
Created May 22, 2020 17:54 — forked from 480/gist:3b41f449686a089f34edb45d00672f28
MacOS X + oh my zsh + powerline fonts + visual studio code terminal settings

MacOS X + oh my zsh + powerline fonts + visual studio code (vscode) terminal settings

Thank you everybody, Your comments makes it better

Install oh my zsh

http://ohmyz.sh/

sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
@guyjin
guyjin / hidpi.txt
Created March 16, 2019 17:09 — forked from simX/hidpi.txt
Enable HiDPI mode in Mountain Lion w/o Quartz Debug
sudo defaults write /Library/Preferences/com.apple.windowserver DisplayResolutionEnabled -bool YES;
sudo defaults delete /Library/Preferences/com.apple.windowserver DisplayResolutionDisabled;
// by the way, you need to logout and log back in for this to take effect. Or at least that's what
// Quartz Debug says. Who knows, maybe it's lying?
// P.S. Go to [Apple menu --> System Preferences --> Displays --> Display --> Scaled] after logging
// back in, and you'll see a bunch of "HiDPI" resolutions in the list to choose from.
angular.module('fpfs')
.controller('speciesMeasuredPUCtrl', function (pu, $rootScope, contractAbstract, subView,
paymentUnits, contractSpecies, regionalSpecies, growl, Api,
fpfsSession, productsList, unitOfMeasure) {
var pu = this;
pu.regionalSpecies = regionalSpecies;
pu.contractRecord = contractAbstract;
pu.contractAbstract = contractAbstract;
pu.contractSpecies = contractSpecies;
@guyjin
guyjin / gulpfile.js
Last active May 17, 2017 18:59
simple gulp setup
var gulp = require('gulp');
var browserSync = require('browser-sync').create();
var cssimport = require("gulp-cssimport");
var url = require("url");
var sass = require('gulp-sass');
var gutil = require('gulp-util');
var wait = require('gulp-wait');
// Static Server + watching scss/html files
gulp.task('serve', function() {