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 isFalsy = value => !value; | |
const isWhitespaceString = value => | |
typeof value === 'string' && /^\s*$/.test(value); | |
const isEmptyCollection = value => | |
(Array.isArray(value) || value === Object(value)) && | |
!Object.keys(value).length; | |
const isInvalidDate = value => | |
value instanceof Date && Number.isNaN(value.getTime()); | |
const isEmptySet = value => value instanceof Set && value.size === 0; | |
const isEmptyMap = value => value instanceof Map && value.size === 0; |
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
<?php | |
/* | |
To generate JWT you need mainly header, payload and secret. | |
Next you create a signature from the encoded header, the encoded payload, a secret, | |
the algorithm specified in the header. | |
The header is a JSON object with the following properties: | |
{ | |
"alg": "HS256", | |
"typ": "JWT" |
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 getAdminTitle = (locationPathname: string) => { | |
switch (locationPathname) { | |
case '/admin': | |
return 'admin'; | |
case ( | |
locationPathname.match( | |
'/admin/[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89aAbB][a-f0-9]{3}-[a-f0-9]{12}/offers', | |
) || {} | |
).input: |
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
import pandas as pd | |
# create dataframe | |
city_data = pd.read_csv('../../Documents/Udacity/city_data.csv') | |
global_data = pd.read_csv('../../Documents/Udacity/global_data.csv') | |
my_city_data = city_data.loc[city_data['city'] == 'Kigali'] | |
paris_data = city_data.loc[city_data['city'] == 'Paris'] | |
# render dataframe as xlsx |
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 chai = require('chai'); | |
const chaiHttp = require('chai-http'); | |
const app = require('../index'); | |
chai.use(chaiHttp); | |
describe('404 and forward to error handler', function () { | |
it('Should return an object', function(done) { | |
chai | |
.request(app) |
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
var foo = function() => { | |
console.log('Hello world'); | |
}; | |
foo(); |
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
babel --plugins transform-es2015-arrow-functions file.js |
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 foo = () => { | |
console.log('Hello world'); | |
} | |
foo(); |