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
/** | |
* Element.closest ponyfill | |
*/ | |
export function elementClosest(element: Element, selector: string): Element | null |
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 { RequestHandler } from 'express'; | |
/** | |
* Combine multiple middleware together. | |
* @param mids | |
*/ | |
export const combineHandlers = (...mids: RequestHandler[]): RequestHandler => | |
mids.reduce((a, b) => (req, res, next) => { | |
a(req, res, err => { | |
if (err) { |
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 { DotenvConfigOptions } from 'dotenv'; | |
const __DEV__ = process.env.NODE_ENV !== 'production'; | |
export type ConfigValue = { | |
value?: (v: string) => any; | |
} & ( | |
| { | |
required: true; | |
} |
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
open System | |
let ( ..|..<++>..|.. ) x y = x + " " + y | |
let ( >.< ) x z = x ..|..<++>..|.. "." ..|..<++>..|.. "Thanks Obama." |> z | |
"custom operators" ..|..<++>..|.. "makes everything worse" >.< Console.WriteLine |
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
sdb connect <ip>:<port> # connect to TV | |
sdb -s <deviceName> capability # get <installationPath> | |
# build | |
tizen cli-config "default.profiles.path=<profile_path>" | |
tizen build-web -out .buildResult -- <source-dir> | |
tizen package --type wgt --sign profileName -- <source-dir>/.buildResult # extract <package-file> | |
mv <package-file> . | |
rm -rf <source-dir>/.buildResult |
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
# https://developer.samsung.com/tv/develop/specifications/web-engine-specifications | |
chrome 47 # Tizen 3.0 2017 | |
chrome 56 # Tizen 4.0 2018 | |
chrome 63 # Tizen 5.0 2019 | |
# http://webostv.developer.lge.com/discover/webos-tv-platform/web-engine/ | |
chrome 38 # webOS TV 3.x 2016-2017 | |
chrome 53 # webOS TV 4.x 2018 |
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 CaseInsensitiveMap from './CaseInsensitiveMap'; | |
describe('CaseInsensitiveMap', () => { | |
it('should be able to construct', () => { | |
const map: Map<string, string> = new CaseInsensitiveMap<string>(); | |
}); | |
it('should be able to construct with values', () => { | |
const map: Map<string, string> = new CaseInsensitiveMap<string>([['key', 'value'], ['key2', 'value2']]); | |
}); | |
it('has case insensitive keys', () => { |
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 { Middleware, Action } from 'redux'; | |
// Grabbed from: | |
// https://github.com/reactjs/redux/blob/master/src/utils/isPlainObject.js | |
function isPlainObject(obj: any) { | |
if (typeof obj !== 'object' || obj === null) return false | |
let proto = obj | |
while (Object.getPrototypeOf(proto) !== null) { | |
proto = Object.getPrototypeOf(proto) |
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
function equals(a1, a2) { | |
return (a1.length == a2.length) && a1.every(function(element, index) { | |
return element === a2[index]; | |
}); |
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 combineResults = async () => { | |
const [a, b, c] = await Promise.all([requestSlowly('a'), requestSlowly('b'), requestSlowly('c')]); | |
return a + b + c; | |
} |