Skip to content

Instantly share code, notes, and snippets.

undefined is not a function

Theodor Lindekaer lindekaer

undefined is not a function
View GitHub Profile
lindekaer / wip.ts
Last active Sep 8, 2019
Exhaustive checking in Typescript
View wip.ts
Exhaustive checking is the concept of ensuring that all possibilities have
been covered when e.g. handling the different cases for values in an enum.
Below are some snippets to achieve this in Typescript.
enum Job {
Engineer = 'engineer',
KeyAccountManager = 'key-account-manager',
  • Detect mobile browsers (
  • Use clickable overlay if clickability can be toggled or facing issues with nested anchors
  • Use minWidth to fixate width for child in flex layouts
  • Use + in front of dates in JS to convert to integer
  • The <link> element for css/fonts etc. can be placed anywhere in the HTML document
  • <SizeMe /> is good for passing down height/width to child components
  • In Knex select statement ordering matters - will override
    •['file.*', ''])
  • Alias fields on GQL query: query { products: books(id: $id) { ... } }
  • Using DocBlocks gives text hints on hover in TS
lindekaer / convert.ts
Last active Aug 9, 2019
Convert Google Chrome bookmark timestamp to JS date
View convert.ts
// A Webkit timestamp is the number of microseconds from "1st of Jan 1601"
// The magic number 11644473600 is the number of seconds between
// "1st of Jan 1601" and "1st of Jan 1970"
export const converWebkitTimestamp = (webkitTimestamp: number): Date => {
const dateInSeconds = Math.round(webkitTimestamp / 1000000) - 11644473600
return new Date(dateInSeconds * 1000)
lindekaer / read-file-lines.js
Created Mar 21, 2017
Read lines in file with Node
View read-file-lines.js
const fs = require('fs')
const minimist = require('minimist')
const args = minimist(process.argv.slice(2))
const lineReader = require('readline').createInterface({
input: fs.createReadStream(args['file'])
lineReader.on('line', (line) => {
// Code...
You can’t perform that action at this time.