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 { useState, useRef, KeyboardEvent, useEffect } from 'react' | |
const TODO_KEY = 'todos' | |
function App() { | |
const inputRef = useRef<HTMLInputElement>(null) | |
const [todos, setTodos] = useState<string[]>(() => { | |
const todoStr: string | null = localStorage.getItem(TODO_KEY) |
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 combine(a, b, operator) { | |
if (operator === 'x') { | |
return a * b; | |
} | |
if (operator === '/') { | |
return a / b; | |
} | |
if (operator === '+') { | |
return a + b; | |
} |
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 _ = require("lodash"); | |
const fs = require("fs"); | |
const teams = [ | |
{ name: "Phap", weight: 5, rank: 5 }, | |
{ name: "Duc", weight: 3, rank: 5 }, | |
{ name: "Bo dao nha", weight: 2, rank: 5 }, | |
]; | |
const list = _.chain(teams) |
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
#!/bin/bash | |
export AWS_ACCESS_KEY_ID="..." | |
export AWS_SECRET_ACCESS_KEY="..." | |
export AWS_SESSION_TOKEN="..." | |
should_terminate_ec2_instance=no | |
sleep_after_terminate_ec2_instance=30s | |
usage() { | |
echo "Usage: ./update-private-dns.sh --terminate-ec2 no --sleep 40s --service a-alias" |
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
/* | |
Given an unsorted array of integersarr, return the length of the longest consecutive elements sequence. | |
You must write an algorithm that runs in O(n) time. | |
Example 1: | |
Input:arr = [100,4,200,1,3,2] |
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
# This file has been auto-generated by i3-config-wizard(1). | |
# It will not be overwritten, so edit it as you like. | |
# | |
# Should you change your keyboard layout some time, delete | |
# this file and re-run i3-config-wizard(1). | |
# | |
# i3 config file (v4) | |
# | |
# Please see https://i3wm.org/docs/userguide.html for a complete reference! |
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 yourdockername/base-php-nginx:latest AS build | |
# BUILD STAGE | |
# the primary reason we have two build stages is so SSH key of private repo's will never | |
# be in final image | |
# COPY IN BUILD SSH KEY | |
# It won't be copied to final image | |
# add this build arg to compose file | |
ARG BUILDKEY | |
RUN if [ -z "$BUILDKEY" ]; then echo "BUILDKEY SSH NOT SET - ERROR"; exit 1; else : ; fi |
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
verb: | |
- create | |
- update | |
- delete | |
- read | |
... | |
subject: | |
- user | |
- listing |
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
# set prefix to control-f | |
set -g prefix C-f | |
#unbind system defined prefix | |
unbind C-b | |
# helps in faster key repetition | |
set -sg escape-time 0 | |
# start session number from 1 rather than 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
import * as k8s from "@pulumi/kubernetes"; | |
import * as kx from "@pulumi/kubernetesx"; | |
// create ns omg | |
const ns = new k8s.core.v1.Namespace("omg", { | |
metadata: { | |
name: "omg", | |
}, | |
}); |
NewerOlder