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
| // Note: Using non-standard V8 feature | |
| // https://code.google.com/archive/p/v8-i18n/wikis/BreakIterator.wiki | |
| // | |
| // The standard is now Intl.Segmenter but no browser implements it yet. | |
| // | |
| function cut(text) { | |
| const iterator = new Intl.v8BreakIterator(["th"]); | |
| iterator.adoptText(text); | |
| const result = []; | |
| let pos = iterator.first(); |
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 * as functions from 'firebase-functions' | |
| import * as admin from 'firebase-admin' | |
| import 'firebase-functions' | |
| import express from 'express' | |
| import { middleware, Client } from '@line/bot-sdk' | |
| admin.initializeApp() | |
| export const bot = functions.https.onRequest((req, res) => { | |
| const config = { | |
| channelAccessToken: functions.config().line.channel.accesstoken, | |
| channelSecret: functions.config().line.channel.secret |
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 * as Immutable from 'immutable' | |
| import * as rxjs from 'rxjs' | |
| import { scan, startWith, map } from 'rxjs/operators' | |
| export function reactiveHangman( | |
| secretWord: string, | |
| letters: rxjs.Observable<string> | |
| ): rxjs.Observable<Output> { | |
| const initialState = initialize(secretWord) | |
| return letters.pipe( |
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
| /* A */ | |
| export function Card (props) { | |
| return ( | |
| <CardContainer centered={props.centered}> | |
| <CardTitle>{props.title}</CardTitle> | |
| <CardContent>{props.children}</CardContent> | |
| </CardContainer> | |
| ) | |
| } | |
| const CardContainer = styled.article` |
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
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
| <title>Document</title> | |
| <style> | |
| .layout { | |
| display: flex; |
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
| <style> | |
| .x{display:inline-block;padding:20px;border-left:1px solid #ddd;font:bold 20px sans-serif} | |
| </style> | |
| <div> | |
| <span class=x style="border:0">[LOGO]</span> | |
| <span class=x>SEE & DO</span> | |
| <span class=x>FESTIVAL & EVENTS</span> | |
| <span class=x>EAT & DRINK</span> | |
| <span class=x>SHOP</span> | |
| <span class=x>STAY</span> |
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
| console.log(require('./library')) |
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
| (defn load-private-key | |
| [key-str] | |
| (crypto/decode-private-key {:algorithm "RSA" | |
| :bytes (-> key-str | |
| crypto/decode-base64)})) | |
| (defn decrypt-str | |
| [private-key text-to-decrypt] | |
| (let [cipher (crypto/create-cipher "RSA/ECB/OAEPWithSHA1AndMGF1Padding")] | |
| (crypto/decrypt private-key |
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 memoizeArraySelector = (baseSelector) => { | |
| let _last = [ ] | |
| return (state) => { | |
| const result = baseSelector(state) | |
| if (arrayEquals(result, _last)) return _last | |
| _last = result | |
| return result | |
| } | |
| } |
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
| '.source.js': | |
| 'import react': | |
| prefix: 'ir' | |
| body: ''' | |
| import React from 'react' | |
| ''' | |
| 'export function': | |
| prefix: 'ef' | |
| body: ''' | |
| export function $1 ($2) { |