Skip to content

Instantly share code, notes, and snippets.

View newyork-anthonyng's full-sized avatar

Anthony Ng newyork-anthonyng

View GitHub Profile
@newyork-anthonyng
newyork-anthonyng / machine.js
Last active April 29, 2023 21:14
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@newyork-anthonyng
newyork-anthonyng / README.md
Last active November 7, 2019 20:05
Helpful backend/heroku commands

Heroku stuff

heroku logs --tail
# show logs

heroku run bash
# run bash instance 

heroku restart
@newyork-anthonyng
newyork-anthonyng / README.md
Last active May 22, 2020 14:36
Commit types
Prefix Description
feat A new feature
fix A bug fix
docs Documentation only changes
refactor A code change that neither fixes a bug nor adds a feature
perf A code change that improves performance
test Adding missing tests or correcting existing tests
build Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
ci Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
@newyork-anthonyng
newyork-anthonyng / RecommendationService.js
Last active May 14, 2019 19:08
mock for RecommendationService
// sites/common/content/static/js/dojo/wsgc/js/RecommendationService.js
// The `RecommendationService` function is the one that is getting saved to `global["wsgc.js.RecommendationService"]`
WSI.Init.once("wsgc.js.RecommendationService", function RecommendationService() {
"use strict";
const apiUrl = WSI.RecommendationService.recommendationUrl;
const brandId = WSI.config.id.toUpperCase();
const productUrl = window.location.pathname;
const productID = productUrl && productUrl.split('/')[2];
const groupList = `${brandId}:${productID}`;
Object.defineProperty(window, "appleSauce", {
configurable: false,
writable: false, // the default is `false`. Making it explicit for learning purpose
value: "yum"
});
window.appleSauce = "eww"
console.log(window.appleSauce); // "yum"
Object.defineProperty(window, "appleSauce", {
configurable: false, // the default is `false`. Making it explicit for learning purpose
value: "yum"
});
window.appleSauce = "eww";
console.log(window.appleSauce); // "eww"
Object.defineProperty(window, "appleSauce", {
configurable: false, // the default is `false`. Making it explicit for learning purpos
value: "yum"
});
delete window.appleSauce; // doesn't work
console.log(window.appleSauce) // "yum"
Object.defineProperty(window, "appleSauce", {
value: "eww"
Object.defineProperty(window, "appleSauce", {
configurable: false,
writable: false,
enumerable: true,
value: "yum"
});