Skip to content

Instantly share code, notes, and snippets.

View hzhu's full-sized avatar
🍵
building matcha.xyz

henryzhu.eth hzhu

🍵
building matcha.xyz
View GitHub Profile
@hzhu
hzhu / dedup_neighbors.md
Last active February 26, 2017 07:46
Remove Neighboring Duplicates

Problem

Write a function that accepts a string argument and removes duplicate characters that are neighbors. If the new string also has duplicate neighbors, those should be removed also.

reduce_dups('abb') => "a"
reduce_dups('abba') => ""
reduce_dups('aba') => "aba"

Analysis of Problem

@hzhu
hzhu / core_actions.csv
Last active July 12, 2018 09:52
Sample of Core Events & Actions
User Action API Event
Sally creates an account /api/account/create “Account Created”
Then searches for a product /api/search “Products Searched”
Then adds the product to their cart /api/cart/update “Product Added”
Then adds a payment method /api/credit_cards “Payment Info Entered”
Then pays for her product /api/orders/new “Order Completed”
@hzhu
hzhu / updating-external-data-when-props-changes-using-promises.js
Created October 25, 2018 02:48 — forked from bvaughn/updating-external-data-when-props-changes-using-promises.js
Example for loading new external data in response to updated props
// This is an example of how to fetch external data in response to updated props,
// If you are using an async mechanism that does not support cancellation (e.g. a Promise).
class ExampleComponent extends React.Component {
_currentId = null;
state = {
externalData: null
};