Skip to content

Instantly share code, notes, and snippets.

Avatar

Damian yungwarlock

View GitHub Profile
View Example bash long and short options
#!/usr/bin/env bash
# Initialize all the option variables.
# This ensures we are not contaminated by variables from the environment.
file=
verbose=0
show_help() {
echo "Hello"
}
@yungwarlock
yungwarlock / pull_request.md
Created Apr 16, 2022
Fixing bazel rules_python import issues
View pull_request.md
@yungwarlock
yungwarlock / insertionsort.py
Created Feb 17, 2022 — forked from pythonbee/insertionsort.py
Insertion sort in python
View insertionsort.py
def insertionsort(A):
#we start loop at second element (index 1) since the first item is already sorted
for j in range(1,len(A)):
key = A[j] #The next item we are going to insert into the sorted section of the array
i = j-1 #the last item we are going to compare to
#now we keep moving the key back as long as it is smaller than the last item in the array
while (i >= 0) and key < A[i]: #if i == -1 means that this key belongs at the start
A[i+1]=A[i] #move the last object compared one step ahead to make room for key
i=i-1 #observe the next item for next time.
View ExampleComponent.js
import React from 'react';
import useFeatureFlag from './useFeatureFlag';
import RecommendationsComponent from './Recommendations.js';
const {
DecoratedComponent: Recommendations,
featureEnabled: recommendationsFeatureEnabled,
FeatureFlag
} = useFeatureFlag({
Component: RecommendationsComponent,
@yungwarlock
yungwarlock / 01-directory-structure.md
Created Apr 22, 2021 — forked from tracker1/01-directory-structure.md
Anatomy of a JavaScript/Node project.
View 01-directory-structure.md

Directory structure for JavaScript/Node Projects

While the following structure is not an absolute requirement or enforced by the tools, it is a recommendation based on what the JavaScript and in particular Node community at large have been following by convention.

Beyond a suggested structure, no tooling recommendations, or sub-module structure is outlined here.

Directories

  • lib/ is intended for code that can run as-is
  • src/ is intended for code that needs to be manipulated before it can be used
@yungwarlock
yungwarlock / 0main.md
Created Aug 16, 2019 — forked from pandeiro/0main.md
Git Best Practices
View 0main.md

Git Best Practices

This is a fairly common question, and there isn't a One True Answer, but still, this represents a consensus from #git

Read about git

Knowing where to look is half the battle. I strongly urge everyone to read (and support) the Pro Git book. The other resources are highly