Skip to content

Instantly share code, notes, and snippets.

@zgiber
zgiber / errors.go
Created October 3, 2016 14:52
custom error type adding some extras over standard error interface
type customError struct {
statusCode int
description string
details interface{}
}
type CustomError interface {
error
StatusCode() int
Details() interface{}
@zgiber
zgiber / main.go
Created September 2, 2016 14:45
Http Server Logging request bodies.
package main
import (
"fmt"
"io"
"log"
"net/http"
"os"
"os/signal"
"time"
# split panes using | and -
bind | split-window -h
bind - split-window -v
unbind '"'
unbind %
# eliminate escape delay
set -s escape-time 0
# reload config file (change file location to your the tmux.conf you want to use)
@zgiber
zgiber / init.vim
Last active August 2, 2016 13:37
neovim
set runtimepath^=/Users/zoltangiber/.config/nvim/dein/repos/github.com/Shougo/dein.vim
set swapfile
set backupdir=~/tmp
set nowrap
" call dein#begin(expand('~/.cache/dein'))
call dein#begin(expand('/Users/zoltangiber/.config/nvim/dein'))
call dein#add('Shougo/dein.vim')
call dein#add('Shougo/unite.vim')
call dein#add('bling/vim-airline')
set nocompatible " be iMproved, required
filetype off " required
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'tpope/vim-sensible'
Plugin 'tpope/vim-fugitive'
Plugin 'jiangmiao/auto-pairs'
Plugin 'tomasr/molokai'
brew install macvim --with-cscope --with-lua
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
package main
import (
"encoding/json"
"fmt"
"log"
"net/http"
"strings"
"golang.org/x/net/context"
@zgiber
zgiber / main.go
Created September 21, 2015 14:29
API access test
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
"net/url"
)
@zgiber
zgiber / closedchannel.go
Created September 2, 2015 08:55
Handling closed channels.
package main
import (
"fmt"
"time"
)
func main() {
c := make(chan string)
@zgiber
zgiber / iteratechannel.go
Created August 31, 2015 13:39
Iterating channel
package main
import "fmt"
import "time"
func main() {
pr := make(chan interface{})
go runme(pr)