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
function App(things) { | |
const newData = useGetNewData(things); | |
function handleClick() { | |
if (newData.length > 0)) { | |
// Woohoo | |
} | |
} | |
return ( |
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 alphabet = [ | |
"a", | |
"b", | |
"c", | |
"d", | |
"e", | |
"f", | |
"g", | |
"h", | |
"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
const crypto = require('crypto'); | |
function createSha256CspHash(content) { | |
return 'sha256-' + crypto.createHash('sha256').update(content).digest('base64'); | |
} |
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
let lateFlag = 0; | |
const isTrainLate = train => (train.sta !== train.eta && train.eta.toLowerCase() !== 'on time'); | |
const processTrains = ({ trainServices }) => trainServices.some((train) => { | |
if (isTrainLate(train)) { | |
console.log(`The ${train.sta} won't arrive until ${train.eta} 😕`); | |
lateFlag = 1; | |
} else if (lateFlag) { | |
console.log('Subsequent trains are running fine'); | |
lateFlag = 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
const fs = require('fs'); | |
const xml2js = require('xml2js'); | |
const parser = new xml2js.Parser(); | |
const builder = new xml2js.Builder(); | |
const createFeedItem = ({ | |
title, | |
filePath, | |
callback |
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 fs = require('fs'); | |
const build = () => { | |
console.info('Building'); | |
// Run your build here | |
}; | |
const watchAndBuild = () => { | |
console.info('Watching files for rebuild'); | |
fs.watch('src', { recursive: true }, build); |
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
add_header X-Xss-Protection "1; mode=block" always; | |
add_header X-Content-Type-Options "nosniff" always; | |
add_header Referrer-Policy no-referrer-when-downgrade; | |
add_header Strict-Transport-Security max-age=15768000; | |
add_header X-Frame-Options SAMEORIGIN; | |
proxy_hide_header X-Powered-By; |
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
sy on | |
set number | |
set hlsearch | |
set tabstop=2 | |
set shiftwidth=2 | |
set softtabstop=2 | |
set expandtab | |
set autoindent | |
set cindent | |
set smartindent |
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
// Run `npm i --save alexa-sdk request` for dependencies | |
const Alexa = require('alexa-sdk'); | |
const request = require('request'); | |
const handlers = { | |
opsviewAuthenticate() { | |
request({ | |
method: 'POST', | |
uri: '********/api/auth', |