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 promise1 = new Promise((resolve, reject) => { | |
setTimeout(resolve, 50, 'one'); | |
}); | |
const promise2 = new Promise((resolve, reject) => { | |
setTimeout(resolve, 60, 'two'); | |
}); | |
const promise3 = new Promise((resolve, reject) => { | |
setTimeout(resolve, 70, 'three'); |
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 markdownIt = require("markdown-it"); | |
const markdownItReplaceLink = require('markdown-it-replace-link'); | |
module.exports = function(eleventyConfig) { | |
let markdownItOptions = { | |
html: true, | |
breaks: true, | |
linkify: true, | |
replaceLink: function (link, env) { | |
link = link.toLowerCase() |
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 ( | |
"crypto/aes" | |
"crypto/cipher" | |
"encoding/hex" | |
"fmt" | |
"strings" | |
) |
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 crypto = require('crypto'); | |
const password = 'password'; | |
function encrypt(password, text) { | |
const algorithm = 'aes-256-ctr'; | |
const key = Buffer.concat([Buffer.from(password), Buffer.alloc(32)], 32); | |
const iv = crypto.randomBytes(16); | |
const cipher = crypto.createCipheriv(algorithm, key, iv); | |
let encrypted = cipher.update(text); |
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.14-alpine AS build | |
WORKDIR /go/src/app | |
ENV CGO_ENABLED=0 | |
RUN apk add --no-cache jq | |
COPY go.mod go.sum ./ | |
RUN go mod download --json | jq -r '"\(.Path)@\(.Version)"' | xargs go get -v | |
COPY . . | |
RUN go build -o /go/bin/app | |
FROM gcr.io/distroless/base |
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.14-alpine AS build | |
WORKDIR /go/src/app | |
ENV CGO_ENABLED=0 | |
RUN apk add --no-cache jq | |
COPY go.mod go.sum ./ | |
RUN go mod graph | cut -d '@' -f 1 | cut -d ' ' -f 2 | sort | uniq | tr '\n' ' ' | xargs go get -v | |
COPY . . | |
RUN go build -o /go/bin/app | |
FROM gcr.io/distroless/base |
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
/* | |
You can add this with the stylish extension using this regex: | |
https:\/\/github\.com/(?!notifications)(.+) | |
Stylish for chrome: https://chrome.google.com/webstore/detail/stylish-custom-themes-for/fjnbnpbmkenffdnngjfgmeleoegfcffe | |
Stylish for firefox: https://addons.mozilla.org/en-US/firefox/addon/stylish/ | |
Based off https://gist.github.com/healingbrew/acc65ad439379eabdbb276e86975275e | |
*/ |
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 ( | |
"fmt" | |
) | |
type number interface { | |
type int, int8, int16, int32, int64, uint, uint8, uint16, uint32, uint64, float32, float64, complex64, complex128 | |
} |
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 ( | |
"fmt" | |
) | |
func Contains(type T comparable)(elems []T, target T) bool { | |
for _, elem := range elems { | |
if elem == target { | |
return true |
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 ( | |
"fmt" | |
"runtime" | |
) | |
// 1e7 is 1 million | |
var listLength int = 1e7 |
NewerOlder