Skip to content

Instantly share code, notes, and snippets.

View omeid's full-sized avatar

Omeid omeid

  • Sydney, Australia
View GitHub Profile

Folder Structure

Motivations

  • Clear feature ownership
  • Module usage predictibility (refactoring, maintainence, you know what's shared, what's not, prevents accidental regressions, avoids huge directories of not-actually-reusable modules, etc)
@omeid
omeid / accesscontrol.go
Last active August 29, 2015 14:17
Go API middleware handler.
package api
import (
"net/http"
"github.com/ORG/PROJECT/user"
)
func accessControl(level user.AccessLevel) func(handler) handler {
return func(handler handler) handler {
@omeid
omeid / express.go
Last active August 29, 2015 14:09
Node.js (Express) Style Go Middleware in 40 line of code.
package main
import (
"log"
"net/http"
"time"
)
type Handler func(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc)
@omeid
omeid / gcc-4.7.3-musl-1.patch
Created October 30, 2014 02:16
GCC 4.7.3 Musl-1 Patch.
Submitted By: Andrew Bradford <andrew@bradfordembedded.com>
Date: 2013-10-14
Initial Package Version: 4.7.3
Origin: Gregor Richards' musl-cross
Upstream Status: None
Description: Patches to gcc to build for musl-libc.
# HG changeset patch
# Parent f50bb54f331f73405131a30b4f353cfda1c70304
Use the generic implementation of libstdc++ primitives when we're on musl, not the glibc one.
@omeid
omeid / css.vim
Created August 26, 2014 13:42 — forked from tpope/css.vim
" Vim indent file
" Language: CSS
" Maintainer: Nikolai Weibull <now@bitwi.se>
" Latest Revision: 2010-12-22
if exists("b:did_indent")
finish
endif
let b:did_indent = 1
@omeid
omeid / output.go
Last active August 29, 2015 14:04
Concept: Martini like Go Meta Framework Using Code Generation.
package main
import (
"fmt"
"log"
"net/http"
"github.com/gorilla/mux"
)
@omeid
omeid / util.go
Last active August 29, 2015 14:04
Golang utils for copypasta.
package main
import (
"crypto/md5"
"crypto/rand"
"encoding/hex"
"encoding/json"
"io"
"net/http"
)
@omeid
omeid / gist:b2c8e7186a99771b0fbb
Created July 27, 2014 17:39
Go Martin Angular.js html5 urls.
package main
import(
"fmt"
"github.com/go-martini/martini"
)
func main() {
m := m := martini.Classic();
m.NotFound(func(w http.ResponseWriter, r *http.Request) {
@omeid
omeid / vm.sh
Created December 1, 2013 10:08
VirtualBox Manager
#!/bin/bash
function vm {
function vm_status {
return $(vboxmanage list runningvms | grep "$1" &> /dev/null);
}
function vm_start {
vboxheadless -s "$1" &> /dev/null & echo "Server is going up..."
# VBoxManage startvm "$1" --type headless &> /dev/null & echo "Server is going up..."
@omeid
omeid / gist:2011557
Created March 10, 2012 14:15
PHP Validator
<?php
class validiator {
/**
* !! The class name isn't misspled, it's just the package name. :) !!
*
* @var array $filters
* @var array $errorMsgs
*