Skip to content

Instantly share code, notes, and snippets.

@shaunoconnell
shaunoconnell / gist:1154345
Created August 18, 2011 15:38
rails rake task to override things. . .for legacy db where user does not have perms
# since we are using a "legacy" schema, we don't want to drop db or tables.'
Rake::TaskManager.class_eval do
def alias_task(fq_name)
new_name = "#{fq_name}:original"
@tasks[new_name] = @tasks.delete(fq_name)
end
end
def alias_task(fq_name)
Rake.application.alias_task(fq_name)
@shaunoconnell
shaunoconnell / gist:1156747
Created August 19, 2011 13:05
FormBuilder adding asterics
class RequiredFieldFormBuilder < ActionView::Helpers::FormBuilder
def label(method, text = nil, options = {}, &block)
new_text = text || method.to_s.titlecase
unless mark_required(object, method).nil?
new_text = "#{new_text} #{mark_required(object, method)}"
end
super(method,new_text, options, &block)
end
@shaunoconnell
shaunoconnell / gist:1156890
Created August 19, 2011 14:13
Fix for dates with jruby on rails and mssqladapter
require 'arjdbc/mssql/adapter'
# I think this is just a hack for mssqlserver 2008
module ::ArJdbc
module MsSQL
module Column
def cast_to_time(value)
return value if value.is_a?(Time)
begin
value_as_time = Time.parse value
function mysql_server() {
7 if [ $# -ne 1 ]; then
8 echo "usage: "
9 echo "> mysql (start|stop)"
10 return 1
11 fi
12
13 case "$1" in
14 "start")
import scala.collection.JavaConversions._
object SampleSort {
def main(args:Array[String]) = {
val myHash = new java.util.concurrent.ConcurrentHashMap[String,String]()
myHash.put("foo", "last")
myHash.put("bar", "first")
myHash.keys().toList.sorted.foreach((key:String) => {
val v = myHash.get(key)
@shaunoconnell
shaunoconnell / PG_Thoughts.md
Created January 19, 2019 16:23
Postgresql thoughts

start w/ plain ole postgresql with replication

RLS should work for visibility on rows

Ageing data off.

@shaunoconnell
shaunoconnell / pom.xml
Created October 16, 2019 23:13
lame poms
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>