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
package httputil | |
import ( | |
"bytes" | |
"io" | |
"io/ioutil" | |
"net/http" | |
"github.com/golang/snappy" | |
) |
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 compoundUnicode(str) { | |
return `${str}` | |
.replace(/\u0065\u0309/g, '\u1EBB') // ẻ | |
.replace(/\u0065\u0301/g, '\u00E9') // é | |
.replace(/\u0065\u0300/g, '\u00E8') // è | |
.replace(/\u0065\u0323/g, '\u1EB9') // ẹ | |
.replace(/\u0065\u0303/g, '\u1EBD') // ẽ | |
.replace(/\u00EA\u0309/g, '\u1EC3') // ể | |
.replace(/\u00EA\u0301/g, '\u1EBF') // ế | |
.replace(/\u00EA\u0300/g, '\u1EC1') // ề |
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
package main | |
import ( | |
"bytes" | |
"encoding/gob" | |
"net/http" | |
"github.com/gin-gonic/gin" | |
) |
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
FROM golang:1.11.1-stretch as builder | |
WORKDIR /ops-golang | |
COPY . ./ | |
RUN CGO_ENABLED=0 \ | |
GOOS=linux \ | |
go build -mod=vendor -o app |
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
package hashcode | |
import "hash" | |
const Size = 4 | |
func NewHash() hash.Hash32 { | |
var s sum32 = 0 | |
return &s | |
} |
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
import { Linking, Platform } from 'react-native' | |
export const maybeOpenURL = async ( | |
url, | |
config, | |
) => { | |
Linking.openURL(url).catch((err) => { | |
if (err.code === 'EUNSPECIFIED') { | |
openInStore({ | |
appStoreLocale: 'us', |
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 MOBILE_REGEXP = /^(\+84|0)(3[2-9]|5[2689]|7[06-9]|8[1-5])[0-9]{7}$/ | |
const PREFIX_CARRIERS = { | |
viettel: ["32","33","34","35","36","37","38","39"], | |
mobifone: ["70","79","77","76","78"], | |
vinaphone: ["83","84","85","81","82"], | |
vietnamobile: ["52","56","58"], | |
gmobile: ["59"] | |
}; | |
function phoneCarrier(phone) { |
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
import firebase from 'firebase' | |
export function defaultDirectKey(users) { | |
return users.sort().join('-') | |
} | |
class Firechat { | |
constructor(firebaseRef, options = {}) { | |
this.directKey = options.directKey || defaultDirectKey | |
this.maximumMessagesFetch = options.maximumMessagesFetch || 100 |
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
import { vec2 } from 'gl-matrix'; | |
const ZERO_VECTOR = vec2.create(); | |
function linePerpendicularToLine(out, vec, middlePoint, weight) { | |
if (weight <= 0 || vec2.equals(vec, ZERO_VECTOR)) { | |
vec2.copy(out[0], middlePoint); | |
vec2.copy(out[1], middlePoint); | |
} else { | |
const perpendicular = vec2.fromValues(vec[1], -vec[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 path = require('path') | |
const { execFile } = require('child_process') | |
function lastCommitId(dir) { | |
return new Promise((resolve, reject) => { | |
const gitArgs = [ | |
`--git-dir=${path.join(dir, '.git')}`, | |
`--work-tree=${dir}`, | |
'rev-parse', |