Skip to content

Instantly share code, notes, and snippets.

View parkerproject's full-sized avatar

Parker parkerproject

View GitHub Profile

FWIW: I (@Rondy) am not the author of the content presented here, which is an outline from Edmond Lau's book. I've just copy-pasted it from somewhere and saved as a personal gist, before it got popular on newsnews.ycombinator.com. I don't remember where exactly the original source is from and neither could find the author's name, so I cannot give him/her the proper credits.


Effective Engineer - Notes

class ListNode {
constructor(value) {
this.value = value;
this.next = null;
}
}
function reverseLinkedList(head, prev = null) {
if (head === null) {
return prev;
// Definition for singly-linked list
function ListNode(val) {
this.val = val;
this.next = null;
}
// Function to reverse a singly-linked list
function reverseLinkedList(head) {
let prev = null;
let current = head;
/*
This memoize function takes in another function as its argument (func)
and returns a new function that caches the results of func based on its arguments.
The returned function first checks if the arguments have already been cached
by checking if there is a key in the cache object with the same JSON stringified arguments (key).
If there is a cached value, it returns it. If not, it invokes the original function func with the arguments,
caches the result under the key, and returns the result.
*/
@parkerproject
parkerproject / docs.md
Created September 18, 2022 15:19 — forked from codeBelt/docs.md
Firestore rules function examples
# https://stackoverflow.com/questions/69343233/github-action-increment-version-on-push-to-main
name: Version Increment
on:
push:
branches:
- main
jobs:
@parkerproject
parkerproject / create_release_branch.yml
Created August 19, 2022 18:10 — forked from riggaroo/create_release_branch.yml
Github Action workflow for creating release branch, updating versionName and versionCode, copying strings.xml to another repo, submitting PRs as per GitFlow.
name: Create Release Branch
on:
workflow_dispatch:
inputs:
versionName:
description: 'Name of version (ie 5.5.0)'
required: true
versionCode:
description: 'Version number (50500)'
required: true
@parkerproject
parkerproject / groupBy.js
Created August 10, 2022 01:32 — forked from robmathers/groupBy.js
A more readable and annotated version of the Javascript groupBy from Ceasar Bautista (https://stackoverflow.com/a/34890276/1376063)
var groupBy = function(data, key) { // `data` is an array of objects, `key` is the key (or property accessor) to group by
// reduce runs this anonymous function on each element of `data` (the `item` parameter,
// returning the `storage` parameter at the end
return data.reduce(function(storage, item) {
// get the first instance of the key by which we're grouping
var group = item[key];
// set `storage` for this instance of group to the outer scope (if not empty) or initialize it
storage[group] = storage[group] || [];
@parkerproject
parkerproject / gist:e6105e224ad1c74ebcb89361e5271bd4
Created July 20, 2022 04:48 — forked from Miserlou/gist:11500b2345d3fe850c92
1000 Largest US Cities By Population
Largest 1000 Cities in America
2013 popuation data - Biggest US Cities By Population
rank,city,state,population,2000-2013 growth
1,New York,New York,8405837,4.8%
2,Los Angeles,California,3884307,4.8%
3,Chicago,Illinois,2718782,-6.1%
4,Houston,Texas,2195914,11.0%
5,Philadelphia,Pennsylvania,1553165,2.6%
@parkerproject
parkerproject / user_stories.md
Created July 18, 2022 23:57 — forked from seanh/user_stories.md
My notes on user stories

User Stories

Reading list

  • [Mark Shead: Creating Good User Stories][Mark Shead]
  • [GOV.UK Service manual: Writing user stories][GOV.UK]
  • [Mike Cohn's blog posts about user stories][Mike Cohn]
  • [Mike Cohn: User Stories Applied (book)][User Stories Applied]