Skip to content

Instantly share code, notes, and snippets.

View AnkurGel's full-sized avatar
:octocat:
Awesomeness

Ankur Goel AnkurGel

:octocat:
Awesomeness
View GitHub Profile
import (
log "github.com/sirupsen/logrus"
"github.com/jinzhu/gorm"
)
type GormLogger struct {}
func (*GormLogger) Print(v ...interface{}) {
if v[0] == "sql" {
log.WithFields(log.Fields{"module": "gorm", "type": "sql"}).Print(v[3])
@mirakui
mirakui / readonly_console.rb
Created May 1, 2012 02:08
readonly rails console using Arproxy
#!/usr/bin/env ruby
APP_PATH = File.expand_path('../../config/application', __FILE__)
require File.expand_path('../../config/boot', __FILE__)
require 'rails/commands/console'
require APP_PATH
Rails.application.require_environment!
require "arproxy"
module Arproxy
class Readonly < Base
# Author: Pieter Noordhuis
# Description: Simple demo to showcase Redis PubSub with EventMachine
#
# Update 7 Oct 2010:
# - This example does *not* appear to work with Chrome >=6.0. Apparently,
# the WebSocket protocol implementation in the cramp gem does not work
# well with Chrome's (newer) WebSocket implementation.
#
# Requirements:
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby