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
<template> | |
<div class="input-wrapper"> | |
<input :type="type" :class="{ 'has-content': value.length }" v-model="value"> | |
<div class="input-label">{{ label }}</div> | |
</div> | |
</template> | |
<script> | |
export default { | |
name: 'Input', |
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 changeCase = require('change-case'); | |
exports.handler = async function(event) { | |
const result = { success: false, name: '' }; | |
if(event.name) { | |
result.name = changeCase.titleCase(event.name); | |
result.success = true; | |
} | |
return result; | |
} |
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
describe('capitalise lambda', () => { | |
it('should capitalise the first letter of every word', () => { | |
const handler = require('capitalise.js').handler; | |
const result = handler({name: 'dan salias'}); | |
expect(result).toStrictEqual({name: 'Dan Salias'}); | |
}); | |
}); |
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
{ | |
... | |
"scripts": { | |
"test": "nvm exec 10.16.3 npx jest", | |
... | |
}, | |
... | |
"devDependencies": { | |
... | |
"jest": "^24.9.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
#!/bin/bash | |
system=linux-x64 | |
directory=$HOME/.node-versions | |
# create directory | |
prepare() { | |
mkdir -p $directory | |
} | |
# install specified version |
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
# node-switch alias | |
alias ns=$HOME/scripts/node-switch.sh | |
# switch node version based on .nvmrc | |
default_node_version=12.13.1 | |
chpwd() { | |
if [[ -f .nvmrc && -r .nvmrc ]]; then | |
ns switch "$(< .nvmrc)" | |
elif [[ $(node --version) != v$default_node_version ]]; then | |
ns switch $default_node_version |
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 myScript = Object.assign(document.createElement('script'), { | |
src: '/some-script.js', | |
type: 'text/javascript', | |
async: true, | |
}); | |
document.head.appendChild(myScript); |
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
{ | |
"scripts": { | |
"postversion": "git reset --soft HEAD~1 && git commit --amend -C HEAD", | |
... | |
} | |
... | |
} | |
} |
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 | |
# get the CloudFront Id | |
CF_DISTRIBUTION_ID=$(aws cloudfront list-distributions \ | |
--query "DistributionList.Items[?contains(Aliases.Items[0], "example.com")] | [0].Id" \ | |
--output text | |
) | |
# invalidate all paths | |
aws cloudfront create-invalidation --distribution-id ${CF_DISTRIBUTION_ID} --paths "/*" |
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
/** | |
* - Create a coinmarketcap.com account and paste your API key below. | |
* - In Google Sheets go to Tools -> Script editor and paste this code in a new CMCIMPORT.gs script file | |
* - Use the function in your sheet, e.g. =CMCIMPORT("ADA") | |
*/ | |
function CMCIMPORT(symbol) { | |
const cache = CacheService.getDocumentCache() | |
if (cache.get('prices') == null) { | |
const response = UrlFetchApp.fetch('https://pro-api.coinmarketcap.com/v1/cryptocurrency/listings/latest?start=1&limit=500&convert=USD',{ | |
headers: { |
OlderNewer