Skip to content

Instantly share code, notes, and snippets.

View gnagel's full-sized avatar
🥳
Cranking on new projects, and nuking tech debt with a flamethrower 🔥

Glenn Nagel gnagel

🥳
Cranking on new projects, and nuking tech debt with a flamethrower 🔥
View GitHub Profile
@gnagel
gnagel / gist:1275493
Created October 10, 2011 14:44
patch
From 2129f60889393ba501d3c615bb54a15c597184db Mon Sep 17 00:00:00 2001
From: nyash <nyashh@gmail.com>
Date: Sun, 7 Aug 2011 01:31:52 +0200
Subject: [PATCH] rails 3.1 support
---
lib/generators/assets/assets_generator.rb | 9 +++++++++
lib/generators/nested_scaffold_generator.rb | 4 ++--
.../stylesheets/stylesheets_generator.rb | 9 ---------
3 files changed, 11 insertions(+), 11 deletions(-)
@gnagel
gnagel / method_logger.rb
Created September 13, 2012 13:44 — forked from nhance/method_logger.rb
Rails compatible method logging. Use this to log all calls to instance methods of a class to the log.
Model.new.foo
require 'benchmark'
require 'pp'
require 'active_record'
require 'sequel'
require 'data_mapper'
@start = Date.parse("2012-12-01")
@end = Date.parse("2012-12-31")
ActiveRecord::Base.establish_connection(adapter: 'mysql2', database: 'escobar_development', cast: false, username: 'root', password: nil, pool: 5, timeout: 5000)
@gnagel
gnagel / ev.rb
Created May 6, 2013 16:23 — forked from dkubb/ev.rb
class User
include DataMapper::Resource
property :id, Serial
property :username, String, :required => true, :unique => true
property :address_street_address, String
property :address_location, String
property :address_subdivision, String
property :address_country, String
type InitFunction func() (interface{}, error)
type ConnectionPoolWrapper struct {
size int
conn chan interface{}
}
/**
Call the init function size times. If the init function fails during any call, then
the creation of the pool is considered a failure.

Setting up Vim as your Go IDE

The final IDE

Intro

I've been wanting to do a serious project in Go. One thing holding me back has been a my working environment. As a huge PyCharm user, I was hoping the Go IDE plugin for IntelliJ IDEA would fit my needs. However, it never felt quite right. After a previous experiment a few years ago using Vim, I knew how powerful it could be if I put in the time to make it so. Luckily there are plugins for almost anything you need to do with Go or what you would expect form and IDE. While this is no where near comprehensive, it will get you writing code, building and testing with the power you would expect from Vim.

Getting Started

I'm assuming you're coming with a clean slate. For me this was OSX so I used MacVim. There is nothing in my config files that assumes this is the case.

Setting up Vim as your Go IDE

The final IDE

Intro

I've been wanting to do a serious project in Go. One thing holding me back has been a my working environment. As a huge PyCharm user, I was hoping the Go IDE plugin for IntelliJ IDEA would fit my needs. However, it never felt quite right. After a previous experiment a few years ago using Vim, I knew how powerful it could be if I put in the time to make it so. Luckily there are plugins for almost anything you need to do with Go or what you would expect form and IDE. While this is no where near comprehensive, it will get you writing code, building and testing with the power you would expect from Vim.

Getting Started

I'm assuming you're coming with a clean slate. For me this was OSX so I used MacVim. There is nothing in my config files that assumes this is the case.

# autoload concerns
module YourApp
class Application < Rails::Application
config.autoload_paths += %W(
#{config.root}/app/controllers/concerns
#{config.root}/app/models/concerns
)
end
end

The Elements of Programming Style

The following rules of programming style are excerpted from the book "The Elements of Programming Style" by Kernighan and Plauger, published by McGraw Hill. Here is quote from the book: "To paraphrase an observation in The Elements of Style by Strunk and White, the rules of programming style, like those of English, are sometimes broken, even by the best writers. When a rule is broken, however, you will usually find in the program some compensating merit, attained at the cost of the violation. Unless you are certain of doing as well, you will probably do best to follow the rules."