Skip to content

Instantly share code, notes, and snippets.

sofyan-ahmad / anorm.scala
Created Nov 23, 2015 — forked from davegurnell/anorm.scala
A short guide to Anorm
View anorm.scala
To run a query using anorm you need to do three things:
1. Connect to the database (with or without a transaction)
2. Create an instance of `anorm.SqlQuery` using the `SQL` string interpolator
3. Call one of the methods on `SqlQuery` to actually run the query
View Upload File - Golang
r.ParseMultipartForm(32 << 20)
file, handler, err := r.FormFile("userphoto")
defer file.Close()
fmt.Fprintf(w, "%v", handler.Header)
f, err := os.OpenFile("./uploads/user_avatars/"+handler.Filename, os.O_WRONLY|os.O_CREATE, 0666)
View 01 - Getting Started Go-Micro: Setting Development Machine Ubuntu
# Settiing your ubuntu development machine
1. Install Consul:
2. Install Protobuf:
3. Install Go Swagger:
4. Install Go Kubernetes:
Have fun with:
View Go Kubernetes Install
# Install go kubernetes
# make sure you have godep: go get
# make sure your $GOROOT/bin is in the right $PATH
# export PATH="$GOPATH/bin:$PATH"
# Just to make sure
# export PATH="$GOROOT/bin:$PATH"
go get -u
cd $GOPATH/src/
View Regex
# Replace string starts with new line with content inside dquote
View Install Consul 0.6.4 on Ubuntu 16.0
sudoapt-get install -y curl unzip
sudo mkdir -p /var/lib/consul
sudo mkdir -p /usr/share/consul
sudo mkdir -p /etc/consul/conf.d
curl -OL
sudo mv consul /usr/local/bin/consul
View mobx-login-store-sample
import { action, observable } from 'mobx';
class LoginStore {
@observable public email = '';
@observable public password = '';
@observable public isValid = false;
@observable public emailError : string | undefined = '';
@observable public passwordError : string | undefined = '';
View loopback-DB-automigrate
var path = require('path');
var lodash = require('lodash');
var app = require(path.resolve(__dirname, '../server/server'));
var models = require(path.resolve(
function autoMigrateAll(dataSourceName) {
sofyan-ahmad / poi.config.ts
Created Jul 18, 2018
poi.config.ts sample !!FOR EXPERIMENTAL ONLY!!
View poi.config.ts
import { Options } from 'poi';
import * as VueLoaderPlugin from 'vue-loader/lib/plugin';
const options: Options = {
entry: './src/main.ts',
html: {
title: 'Vuex with TypeScript example',
template: './index.html',
homepage: '.',