Skip to content

Instantly share code, notes, and snippets.

View steebchen's full-sized avatar
🌴
Working remotely

Luca Steeb steebchen

🌴
Working remotely
View GitHub Profile
user, err := client.User.FindOne().Exec(ctx)

email, ok := user.Email()
if !ok {
  return fmt.Errorf("email is null")
}

log.Printf("User email is set")
localhost/user
localhost/user?name[equals]=stuff
localhost/user?name[contains]=stuff
func (r UserResolver) User(ctx context.Context, input UserFilterInput) (User, error) {
  query := User.Query()
 
localhost/user
localhost/user?name[equals]=stuff
localhost/user?name[contains]=stuff
func (r UserResolver) User(ctx context.Context, input UserFilterInput) (User, error) {
  query := User.Query()
 
@steebchen
steebchen / test.md
Last active December 9, 2019 10:22

No

  • a: code(hi) Ok: stuff
  • b: code(hi)

Ok:

@steebchen
steebchen / check.sh
Last active June 9, 2020 07:34
Check if a given Github Action succeeds
#!/bin/sh
# This script checks if the prisma e2e test workflow passes
# Check the end of the file for usage
check() {
str=$(curl -s "https://github.com/$1/workflows/$2/badge.svg")
case "$str" in
*"passing"*)
@steebchen
steebchen / scratch.go
Created January 18, 2020 16:57
Prisma Go database client error handling
package main
import (
"errors"
"fmt"
"log"
)
func main() {
// Since FindMany only reads data, there can be no expected errors. There may
@steebchen
steebchen / swap
Created March 23, 2020 14:30
Swap two files in a naming scheme of "xx-yy" where xx is a number and yy a string
#!/bin/bash
set -eu
a=$1
b=$2
mv "$a" "$a.backup"
mv "$b" "$b.backup"
@steebchen
steebchen / insert
Last active March 23, 2020 14:37
Shift files in a naming scheme of "xx-yy" where xx is a number to create space at a given index
#!/bin/bash
set -eu
new=$1
for file in $(ls | sort -g -r)
do
filename=$(basename "$file")
number=$(echo $filename | cut -d- -f1)
@steebchen
steebchen / mdtool
Last active February 12, 2021 13:28
bugfixes by imchairmanm
#!/bin/bash
set -e
swap() {
set -eu
a=$1
b=$2
## example
```js
const user = await prisma.user.update({
where: {
email: 'alice@prisma.io',
},
data: {
posts: {