Skip to content

Instantly share code, notes, and snippets.

View alperen's full-sized avatar

Alperen Turkoz alperen

View GitHub Profile
package main
import (
"bufio"
"encoding/json"
"fmt"
"log"
"net"
"strconv"
)
@alperen
alperen / main.go
Last active February 19, 2020 12:14
Go - Gin Framework Handle Panics
func handlePanics() gin.HandlerFunc {
return func(context *gin.Context) {
defer func() {
if rval := recover(); rval != nil {
context.AbortWithStatusJSON(http.StatusInternalServerError, gin.H{error: rval.(string)})
// do more
return
}
}()
#include <stdio.h>
#include <stdlib.h>
struct stack{
int top;
int count;
int* arr;
};
void init(struct stack *ptr, int size){