Skip to content

Instantly share code, notes, and snippets.

@terrbear
terrbear / gist:1683981
Created January 26, 2012 17:43
git stuff for bashrc
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/[\1]/'
}
function proml {
local BLUE="\[\033[0;34m\]"
local RED="\[\033[0;31m\]"
local LIGHT_RED="\[\033[1;31m\]"
local GREEN="\[\033[0;32m\]"
loop do
puts "FOREVER!@!@111"
end
unless a && b || c
do_something
else
do_something_else
end
[15:53][theath@ironman:~/neo/secmgr[master]]$ irb
Couldn't load Wirble: cannot load such file -- wirble
ruby-head :001 > 1843868956.kind_of?(Fixnum)
=> true
ruby-head :002 > 1843868956.instance_of?(Fixnum)
=> true
ruby-head :003 > 1843868956.is_a?(Fixnum)
=> true
ruby-head :004 > exit
[15:54][theath@ironman:~/neo/secmgr[master]]$ ruby -v
/*
* jQuery UI Dialog 1.8.16
*
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Dialog
*
* Depends:
= if((sum(arrayformula(if(sort(split(lower(indirect(address($A2, 6, true, true, "app vulnerabilities"))), " ", false)) = sort(split(lower(indirect(address($B2, 6, true, true, "app vulnerabilities"))), " ", false)), 1, 0))) * 2) = (sum(arrayformula(if(sort(split(lower(indirect(address($A2, 6, true, true, "app vulnerabilities"))), " ", false)) = sort(split(lower(indirect(address($A2, 6, true, true, "app vulnerabilities"))), " ", false)), 1, 0))) + sum(arrayformula(if(sort(split(lower(indirect(address($B2, 6, true, true, "app vulnerabilities"))), " ", false)) = sort(split(lower(indirect(address($B2, 6, true, true, "app vulnerabilities"))), " ", false)), 1, 0)))), VLOOKUP(F1, 'score values'!$A$1:$D$15, 2, false), min(sum(arrayformula(if(sort(split(lower(indirect(address($A2, 6, true, true, "app vulnerabilities"))), " ", false)) = sort(split(lower(indirect(address($B2, 6, true, true, "app vulnerabilities"))), " ", false)), 1, 0))) * VLOOKUP(F1, 'score values'!$A$1:$D$15, 3, false), VLOOKUP(F1, 'score values'!$A$1:
Contact.search do
all do
first_name 'Jen'
last_name 'Lee'
buying_terry_beer 'yes'
end
end
In case y'all wanted to play with it - I'm working on getting a shitload of data into the index to see how aggressively we need to look into this. We should also compare numbers y'all are seeing vs the ones I am, since I'm running everything locally and don't have the same VM I/O performance issues that you might be running into (which might be a big deal if we host a lot of instances on VMs)
https://github.com/bhb/rack-perftools_profiler
I think the VM I/O performance is worth evaluating a little more (probably not before the dupe logic stuff or getting a proper CI environment or anything, but by end of 2011). Here are some (admittedly, older) posts about VM I/O:
http://www.codinghorror.com/blog/2006/10/the-single-most-important-virtual-machine-performance-tip.html
http://www.codinghorror.com/blog/2005/02/virtual-pc-2004-tips.html
http://www.hanselman.com/blog/CommentView.aspx?guid=097ce75a-838a-4511-a858-d6de8e8e78a9
http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&exter
class JiraTicket
def hello_there
"hello there"
end
end
jt = JiraTicket.new
puts "hello there: #{jt.hello_there}"
form_names = AdHocTemplate.active.map(&:canonical_name)
states = %w(pending in_progress submitted)
Contact.all.each do |c|
form_names.each do |form|
forms = AdHocForm.where(:template_canonical_name => form, :contact_id => c.id).all
next if forms.empty?
forms = forms.to_a.sort{|a, b| states.index(a.aasm_state) <=> states.index(b.aasm_state)}
forms.pop
forms.each{|f| f.destroy}