Skip to content

Instantly share code, notes, and snippets.

View kitz99's full-sized avatar

Bogdan Timofte kitz99

View GitHub Profile

Keybase proof

I hereby claim:

To claim this, I am signing this object:

package main
import (
"fmt"
"reflect"
)
func wrapFunction(inputFunc interface{}) interface{} {
funcType, funcValue := reflect.TypeOf(inputFunc), reflect.ValueOf(inputFunc)
package main
import (
"fmt"
"reflect"
)
type User struct {
ID int
Email string `json:"email" yaml:"email_address"`
package main
import (
"fmt"
"reflect"
)
type User struct {
ID int
Email string `json:"email" yaml:"email_address"`
import (
"fmt"
"reflect"
)
type Rectangle struct {
Width int
Height int
}
#!/bin/bash
dirName="$1"
permissions=${2:-0755}
[ $# -eq 0 ] && { echo "Could not create a directory without a name"; exit 1; }
[ ! -d "$dirName" ] && mkdir -m $permissions -p "$dirName"
dir="/src/data"
echo "$dir"
printf "$dir\n"
echo "The source directory is set to: ${dir}. Do you want to continue?"
version: '3'
services:
db:
image: mysql:5.7
volumes:
- ./data_dir:/var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: choosepasswd
const obj = { opt1: ["a", "b", "c", "d"], opt2: {opt21: "aaaa", opt22: false}, opt3: "http://exaple.com" }
JSON.stringify(obj, null, 4);
// "{
// "opt1": [
// "a",
// "b",
// "c",
// "d"
const data = "This sentence uses word1 and also word2"
// using regex groups to extract word1 and word2
var result = data.match(/^This sentence uses (.*) and also (.*)$/);
const opt1 = resutt[1];
const opt2 = result[2];
// using destructuring
const { 3: opt1, 6: opt2 } = data.split(' ');