Skip to content

Instantly share code, notes, and snippets.

import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;
import org.springframework.aop.framework.ProxyFactory;
public class AopTester {
public interface MyInterface {
public void doStuff();
}
@bdeterling
bdeterling / Setup Slice with Passenger
Created December 22, 2010 16:17
Instructions I used to set up a new Ubuntu server with rvm, passenger, rails, etc
These instructions have two purposes: 1) my own notes so I can more easily set up a new machine next time; 2) help for a Rails n00b to get a machine and a project set up without having to make all the same mistakes I did.
This walks you through setting up a remote Linux server and creating a Rails 3 project locally, using Github and Capistrano to collaborate and deploy.
Local -> means on your machine which should be a Unix variant (some OS X specifics may have snuck in)
Server -> means the server
Local ->
setup a /etc/hosts entry to map the IP to a simple name, hereafter 'server'
require 'benchmark'
n = 1000000
m = n.to_s
Benchmark.bm do |x|
x.report("assign single") { n.times do; c = 'a string'; end}
x.report("assign double") { n.times do; c = "a string"; end}
x.report("assign interp") { n.times do; c = "a #{n} string"; end}
x.report("concat single") { n.times do; 'a ' + n.to_s + ' string b ' + n.to_s + ' string'; end}
x.report("concat double") { n.times do; "a " + n.to_s + " string b " + n.to_s + " string"; end}
x.report("concat interp") { n.times do; "a #{n} string b #{n} string"; end}
@bdeterling
bdeterling / Static site capfile
Created February 11, 2011 04:34
Example of using Capistrano for a static website
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
default_run_options[:pty] = true
# be sure to change these
set :github_user, '<github_user_name>'
set :github_application, "<repository_name>"
set :user, '<user_on_server>'
set :domain, '<server_name>'
set :application, '<domain_name_of_static_site>'
@bdeterling
bdeterling / gist:5563683
Created May 12, 2013 14:02
Method to extract parameters from Hibernate query
private Map getParameters(Object obj) {
Map parameters = new HashMap();
Object query = null;
if (obj instanceof AbstractQueryImpl) {
query = obj;
} else {
return parameters;
}
try {
AbstractQueryImpl q = (AbstractQueryImpl) query;
$ git reflog
da58ab7 HEAD@{0}: pull: Fast-forward
a065dcd HEAD@{1}: checkout: moving from master to master
a065dcd HEAD@{2}: checkout: moving from production to master
d08ce11 HEAD@{3}: commit: Fixed database connection.
2b9b530 HEAD@{4}: commit: Fixed database connection.
a5d325b HEAD@{5}: checkout: moving from qa to production
a5d325b HEAD@{6}: commit: Set up production deploy.
2d8b461 HEAD@{7}: pull: Fast-forward
abb81aa HEAD@{8}: commit: Fixed solr again.
da58ab7 HEAD@{2015-11-16 14:46:56 -0600}: pull: Fast-forward
a065dcd HEAD@{2015-11-16 14:46:00 -0600}: checkout: moving from master to master
a065dcd HEAD@{2015-11-16 14:45:46 -0600}: checkout: moving from production to master
d08ce11 HEAD@{2015-11-10 16:03:46 -0600}: commit: Fixed database connection.
2b9b530 HEAD@{2015-11-10 16:02:31 -0600}: commit: Fixed database connection.
a5d325b HEAD@{2015-11-10 15:29:34 -0600}: checkout: moving from qa to production
a5d325b HEAD@{2015-11-10 15:29:24 -0600}: commit: Set up production deploy.
2d8b461 HEAD@{2015-11-10 15:28:52 -0600}: pull: Fast-forward
abb81aa HEAD@{2015-11-02 16:00:45 -0600}: commit: Fixed solr again.
a9a741d HEAD@{2015-11-02 15:25:50 -0600}: commit: Cleaned up solr deploy.

Keybase proof

I hereby claim:

  • I am bdeterling on github.
  • I am bdeter (https://keybase.io/bdeter) on keybase.
  • I have a public key ASCTJWaMrT4tBjTDBUG0h78eyjjIAiw-McmUKYWYzadTVwo

To claim this, I am signing this object:

# HEADER
## HEADER 2
### Header 3
*bold*
_italics_
- list1
- list 2
- list 3