Skip to content

Instantly share code, notes, and snippets.

@jemmons
jemmons / #dotfiles
Last active February 23, 2021 02:38
Configuration dotfiles for various command line tools.
# Configuration dotfiles for various command line tools.
#JOSHDO: ${1:"do something"} (`date "+%m/%d/%y"`)
$2
function updateButtonState(){
browsed && enable(UPLOAD);
selected && enable(SELECT);
(browsed && selected) && enable(REPLACE);
function enable(i){
buttons.eq(i).removeAttr("disabled");
}
}
class Object
def nil_or
self
end
def not_nil?
true
end
end
<script>
Event.observe(window, "load", function(){
$("payment_type_id").value = "";
});
</script>
def self.assessment_note_value_for(company, question)
if self.assessment_question_value_for(company, question).not_nil?
if(set = company.question_set)
if(CUSTOM_QQ_NOTES[set])
return CUSTOM_QQ_NOTES[set][question.dss_version][question.number]
end
end
end
end
-(IBAction)show:(id)sender{
CGRect frame = [aView frame];
frame.origin.y = [[self view] bounds].size.height;
[aView setFrame:frame];
[[self view] addSubview:aView];
[UIView beginAnimations:@"slide up" context:NULL];
frame.origin.y = [[self view] bounds].size.height - frame.size.height;
[aView setFrame:frame];
[UIView commitAnimations];
@jemmons
jemmons / test.rb
Created March 20, 2013 17:03
Tabs shouldn't matter
module Foo
module Bar
class Baz
def self.quux
puts "hello, world" end end end end
Foo::Bar::Baz.quux()
module Fred
@jemmons
jemmons / config.ru
Created March 20, 2013 17:36
Rackup without tabs
require 'bundler/setup'
Bundler.require(:default)
module Fred; module Barny; module Wilma; def self.betty; "hello, bedrock!" end end end end
app = proc do |env| [200, { 'Content-Type' => 'text/html' }, Fred::Barny::Wilma.betty()]; end
run app
def self.with_memory_db
old_db_config = ActiveRecord::Base.connection_config
ActiveRecord::Base.establish_connection :adapter=>"sqlite3", :database=>":memory:"
yield(ActiveRecord::Base.connection) if block_given?
ensure
ActiveRecord::Base.establish_connection old_db_config
end