This file contains hidden or 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
type IsoFn<T> = { | |
(param: T): T; | |
} | |
interface User { | |
id: number; | |
name: string; | |
address: string; | |
} |
This file contains hidden or 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
interface User { | |
id: number; | |
name: string; | |
address: string; | |
} | |
interface UserStringAttrFunc { | |
(user: User): string; | |
} |
This file contains hidden or 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 getName: UserStringAttrFunc = path('name'); | |
const getAddress: UserStringAttrFunc = path('address'); |
This file contains hidden or 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
interface User { | |
id: number; | |
name: string; | |
address: string; | |
} | |
interface UserStringAttrFunc { | |
(user: User): string; | |
} |
This file contains hidden or 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
interface User { | |
id: number; | |
name: string; | |
address: string; | |
} | |
const getName = (user: User): string => user.name; |
This file contains hidden or 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 getName = path('name'); | |
const upperCase = (str) => str.toUpperCase(); | |
const shoutName = pipe( | |
getFirstName, | |
upperCase, | |
); |
This file contains hidden or 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 | |
# Pulls JIRA ID from current branch | |
JIRA_ID=$(git branch | grep \* | grep -Eo '([A-Z]*-[0-9]*)' | head -n1) | |
# Only scan if JIRA ID found | |
if [[ -n "$JIRA_ID" ]]; then | |
TMP=$GIT_DIR/hooks/$JIRA_ID.txt | |
touch $TMP | |
# Write all matching TODOs to $TMP |
This file contains hidden or 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 | |
# Excluding build/bin/lib directories and uncommented files | |
# this will scan the current dir for any JIRA ticket refs | |
# matching that found in the current git branch name. | |
# Example: | |
# current branch -> feature/DAS-1234-do-task | |
# greps for DAS-1234 and fails commit if found | |
CR=$'\n' |
This file contains hidden or 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 fetch = require('isomorphic-fetch'); | |
const R = require('ramda'); | |
const formatTweetText = R.pipe( | |
R.replace(/(?<=data-expanded-url="[^"]+)".*/, ''), | |
R.replace(/<a href=.*data-expanded-url="/, '\n'), | |
R.replace(/"/g, '"') | |
); | |
const parseTweetText = R.pipe( |
This file contains hidden or 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 sleep = ms => new Promise(res => setTimeout(res, ms)); | |
const animationCharGenerator = async function* (chars, rate = 5) { | |
const interval = 1000 / rate; | |
const numChars = chars.length; | |
let i = 1; | |
// return first char with no delay | |
yield chars[0]; |