We start of with a simple example: Iterate through and increment the value of the key
counter := make(map[string]int)
count := 1000
for i := 0; i < count; i++ {
counter["key"]++
}| package main | |
| import ( | |
| "errors" | |
| "fmt" | |
| ) | |
| var ( | |
| errInvalid = errors.New("validation err") | |
| errUploadFail = errors.New("upload err") |
| package main | |
| import ( | |
| "context" | |
| "errors" | |
| ) | |
| type object struct { | |
| dependencyDAO DependencyDAO | |
| } |
| class apiClient { | |
| static uploadProfilePicture(file) { | |
| var formData = new FormData(); | |
| formData.append("image", file); | |
| formData.append("from", "frontend"); | |
| return postImage(`/user/upload`, formData).then((res) => res); | |
| } | |
| } |
| import * as crypto from "crypto"; | |
| export function verifyPassword(password, hashedPassword) { | |
| const isValid = _compare(password, hashedPassword); | |
| return isValid; | |
| } | |
| // https://stackoverflow.com/questions/27970431/using-sha-256-with-nodejs-crypto | |
| function _compare(inputPassword, hashedPassword) { | |
| const hashedInputPassword = crypto.createHash('sha256').update(inputPassword).digest('hex'); |
| package wkhtmltoimage | |
| import ( | |
| "errors" | |
| "io/ioutil" | |
| "os" | |
| "os/exec" | |
| "strconv" | |
| "strings" | |
| ) |
| -- https://github.com/Big-Time-Data/blog-snippets/blob/main/loading-dynamic-csv-files-with-snowflake/snippets.sql | |
| -- usage: call load_csv('@unit_test_data/bookings_ut_v3/expected/FACT.BOOKINGS.csv', 'FACT', 'BOOKINGS'); | |
| create or replace procedure load_csv(file_location varchar, target_schema varchar, target_table varchar) returns string language JAVASCRIPT strict EXECUTE AS CALLER AS | |
| $$ | |
| const maxNumberOfColumns = 60 // max is 100 // not strict // TODO: query from target table and count | |
| const exec = (sqlText) => { | |
| stmt = snowflake.createStatement({sqlText}); | |
| return stmt.execute(); | |
| } |
ANCESTOR=123;
COMMIT_TO_CHECK=456;
git -C . merge-base --is-ancestor $ANCESTOR $COMMIT_TO_CHECK && echo 'IS ANCESTOR' || echo 'IS NOT ANCESTOR';