Skip to content

Instantly share code, notes, and snippets.

View L04DB4L4NC3R's full-sized avatar
😏
Noob is just a state of mind

Angad Sharma L04DB4L4NC3R

😏
Noob is just a state of mind
View GitHub Profile
@L04DB4L4NC3R
L04DB4L4NC3R / fix.sh
Created January 11, 2020 22:56
HEROKU H10 series errors
# Logs weren't giving me any clues.
# So I scaled down and scaled back up the dynos.
#This solved the problem for me:
heroku ps:scale web=0
# Waited a few seconds...
sleep(4)
heroku ps:scale web=1
@L04DB4L4NC3R
L04DB4L4NC3R / herokuconfig.sh
Created January 11, 2020 17:08
Heroku config script
#!/bin/bash
while p= read -r line; do
heroku config:set $line
done < ./.env
@L04DB4L4NC3R
L04DB4L4NC3R / gist:9cc03bc3307d20297dbdcb47dd4ab4d3
Created January 10, 2020 21:57
FormData in fetch. [Not solved yet, KMN]
https://muffinman.io/uploading-files-using-fetch-multipart-form-data/
@L04DB4L4NC3R
L04DB4L4NC3R / errors.go
Created December 26, 2019 22:37
Clean Architecture
package views
import (
"encoding/json"
"errors"
"net/http"
log "github.com/sirupsen/logrus"
pkg "github.com/L04DB4L4NC3R/jobs-mhrd/pkg"
@L04DB4L4NC3R
L04DB4L4NC3R / errors.go
Created December 26, 2019 22:35
Clean arch
package errors
import (
"errors"
)
var (
ErrNotFound = errors.New("Error: Document not found")
ErrNoContent = errors.New("Error: Document not found")
ErrInvalidSlug = errors.New("Error: Invalid slug")
@L04DB4L4NC3R
L04DB4L4NC3R / user.go
Created December 26, 2019 22:16
Clean Arch
package handler
import (
"encoding/json"
"net/http"
"github.com/L04DB4L4NC3R/jobs-mhrd/api/middleware"
"github.com/L04DB4L4NC3R/jobs-mhrd/api/views"
"github.com/L04DB4L4NC3R/jobs-mhrd/pkg/user"
"github.com/dgrijalva/jwt-go"
@L04DB4L4NC3R
L04DB4L4NC3R / service.go
Created December 26, 2019 22:14
Clean Arch
package user
import (
"context"
"crypto/md5"
"encoding/hex"
"errors"
)
type Service interface {
@L04DB4L4NC3R
L04DB4L4NC3R / repository.go
Created December 26, 2019 22:12
Clean Arch
package user
import (
"context"
)
type Repository interface {
FindByID(ctx context.Context, id uint) (*User, error)
BuildProfile(ctx context.Context, user *User) (*User, error)
@L04DB4L4NC3R
L04DB4L4NC3R / entity.go
Created December 26, 2019 22:09
Clean Arch
package user
import "github.com/jinzhu/gorm"
type User struct {
gorm.Model
FirstName string `json:"first_name,omitempty"`
LastName string `json:"last_name,omitempty"`
Password string `json:"password,omitempty"`
PhoneNumber string `json:"phone_number,omitempty"`