Skip to content

Instantly share code, notes, and snippets.

@jinzhu
jinzhu / main.go
Created October 1, 2015 00:07
handle postgres json with gorm
package main
import (
"fmt"
"github.com/jinzhu/gorm"
_ "github.com/lib/pq"
)
func main() {
@jinzhu
jinzhu / resort.go
Created September 29, 2015 07:55
reset sorting positions
package main
import (
"reflect"
"github.com/qor/qor-example/app/models"
"github.com/jinzhu/gorm"
"github.com/qor/qor-example/db"
)
@jinzhu
jinzhu / README.md
Last active August 29, 2015 14:26 — forked from bodhi/README.md
The Telegram Problem

Implement the function handle to accept lines of text and output reformatted text, wrapped at columnWidth characters, without breaking words.

So

Yr brunch Godard, readymade pug Pinterest gastropub put a bird on it Tumblr.
Sartorial swag beard, selvage bitters tofu vinyl.
Tattooed kogi organic scenester heirloom, cred four loko cardigan cray meh Portland master cleanse photo booth Shoreditch farm-to-table.

when wrapped at 30 characters becomes

buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.4'
}
}
apply plugin: 'android'
fb629b0... 11/23/13 15:49 private
7479510 11/15/13 13:21 public
c4da64e... 04/29/13 12:56 public
5285857 04/02/13 00:08 public
5279532 03/31/13 12:20 public
dfca60f... 01/23/13 17:44 public
cec5482... 12/26/12 15:51 public
+ 4010380 11/04/12 12:57 public Qor DSL examples
2904020 06/10/12 13:50 public nginx microcaching config example
+ 2099624 03/19/12 14:50 public Get hot vim scripts
package main
import (
"fmt"
"log"
"os"
"runtime"
"runtime/debug"
"runtime/pprof"
"strconv"
;;; tabbar+.el --- Tabbar extensions
;; Copyright (C) 2012
;; Author:
;; Keywords:
;; Version 0.2.2
;;; Commentary:

Manage your gmail account in emacs with mu4e

There're a lot of combinations to manage your email with emacs, but this works for me. I've a backup and I can manage my daily email.

The stack:

  • emacs
  • offlineimap
  • mu
  • mu4e
@jinzhu
jinzhu / gemfile.rb
Created November 4, 2012 04:57
Qor DSL examples
require 'qor_dsl'
module Gemfile
class Configuration
include Qor::Dsl
default_configs [ENV['BUNDLE_GEMFILE'], 'Gemfile']
node :gem
[:git, :path, :group].map do |name|
node name do
@jinzhu
jinzhu / gist:2904020
Created June 10, 2012 05:50 — forked from fennb/gist:1283573
nginx microcaching config example
# Set cache dir
proxy_cache_path /var/cache/nginx levels=1:2
keys_zone=microcache:5m max_size=1000m;
# Virtualhost/server configuration
server {
listen 80;
server_name yourhost.domain.com;
# Define cached location (may not be whole site)