This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Associate a branch with story 123: | |
git checkout -b ac/ch123/my-story-name | |
# Or, you might want to associate a single commit with story 123: | |
git commit -m "Fix bug [ch234]" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
old_sha="87d4fed" | |
new_sha="2d5b22d" | |
git log $old_sha..$new_sha --oneline | |
# 2d5b22d Merge pull request #6 from company/me/ch345/my-story-name | |
# e730351 Fix bug | |
# c410ba0 Fix other bug [ch1004] | |
function clubhouse_find_stories_in_commit_range { | |
old_sha="$1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Define the range of commits in this deploy. | |
old_sha="87d4fed" | |
new_sha="2d5b22d" | |
# Define a comment to be posted to each story. | |
deploy_id="v1.1234" | |
deploy_url="https://github.com/company/repo/compare/$old_sha...$new_sha" | |
comment="This story was deployed as part of $deploy_id.$deploy_url" | |
# Move stories to deployed and post a comment. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
APP_DIR="$1" | |
TEMP_FILE="codebase-age-histogram.txt" | |
OUTPUT_FILE="codebase-age-histogram.csv" | |
pushd $APP_DIR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for (var i = 0; i < 1000; i++) { | |
logAndRedirect(i); | |
} | |
window.location.href = window.location.href; | |
function logAndRedirect(i) { | |
setTimeout(function () { | |
window.console.log(i); | |
}, i); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
This is a quick attempt to make Google Meet work better for someone in Kindergarten | |
(one in particular - it may or may not work for yours). | |
Requirements: | |
- I used the "Stylebot" extension to make this CSS work, but any other related extension should also work. | |
Changes: | |
- Hides the "who's here" rotating carousel which is distracting. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Simple implementation of lodash.get | |
// Handles arrays, objects, and any nested combination of the two. | |
// Also handles undefined as a valid value - see test case for details. | |
// Based on: https://gist.github.com/harish2704/d0ee530e6ee75bad6fd30c98e5ad9dab | |
export function deepGet(obj, query, defaultVal) { | |
query = Array.isArray(query) ? query : query.replace(/(\[(\d)\])/g, '.$2').replace(/^\./, '').split('.'); | |
if (!(query[0] in obj)) { | |
return defaultVal; | |
} | |
obj = obj[query[0]]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Simple implementation of lodash.cloneDeep | |
// Does not clone functions or handle recursive references. | |
export function deepClone(original) { | |
if (original instanceof RegExp) { | |
return new RegExp(original); | |
} else if (original instanceof Date) { | |
return new Date(original.getTime()); | |
} else if (Array.isArray(original)) { | |
return original.map(deepClone); | |
} else if (typeof original === 'object' && original !== null) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Converts a getTimezoneOffset() offset to one that can be used in new Date(). | |
// Examples: | |
// Eastern Standard Time: 240 -> '-04:00' | |
// India Standard Time: -330 -> '+05:30' | |
// Australian Central Western Standard Time: -525 -> '+08:45' | |
export function getTimezoneOffset(d) { | |
return convertTimezoneOffset(d.getTimezoneOffset()); | |
} | |
export function convertTimezoneOffset(offset) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const tableName = 'crayons'; | |
const crayons = [ | |
{ id: 1, color: 'blue', updated_at: new Date('2022-02-10T11:31:25-0500') }, | |
{ id: 2, color: 'black', updated_at: new Date('2022-02-10T11:31:25-0500') }, | |
{ id: 3, color: 'brown', updated_at: new Date('2022-02-10T11:31:25-0500') }, | |
{ id: 4, color: 'green', updated_at: new Date('2022-02-10T11:31:25-0500') }, | |
]; | |
// Upsert multiple entries to a table, returning number of rows changed |