Skip to content

Instantly share code, notes, and snippets.

View joecannatti's full-sized avatar

Joe Cannatti joecannatti

View GitHub Profile
@joecannatti
joecannatti / shell.rb
Created August 22, 2012 12:53
shell.rb
scan 'patient-2-nvp', COLUMNS => ['d:subtype', 'd:ehrSystemIdQualifier'], LIMIT => 10 }
import org.apache.hadoop.hbase.filter.CompareFilter
import org.apache.hadoop.hbase.filter.SingleColumnValueFilter
import org.apache.hadoop.hbase.filter.SubstringComparator
import org.apache.hadoop.hbase.util.Bytes
scan 'patient-2-nvp', { COLUMNS => ['d:ehrSystemIdQualifier'], LIMIT => 2000, FILTER => SingleColumnValueFilter.new(Bytes.toBytes('d'), Bytes.toBytes('ehrSystemIdQualifier'), CompareFilter::CompareOp.valueOf('EQUAL'), SubstringComparator.new('MEDS_HX_REVIEW')) }
scan 'patient-2-nvp', { COLUMNS => ['d:ehrSystemIdQualifier'], LIMIT => 20, FILTER => SingleColumnValueFilter.new(Bytes.toBytes('d'), Bytes.toBytes('provIds'), CompareFilter::CompareOp.valueOf('NOT_EQUAL'), BinaryComparator.new(Bytes.toBytes(''))) }
class Task
attr_accessor :name
attr_accessor :assigned_to_user_id
attr_accessor :due_on
def save
Storer.store(self)
end
end
select COALESCE(a.num + b.num + c.num + d.num, 0) as total, channels.id as master_channel_id
from channels
left join
(select name, channels.id as channel_id, count(*) as num from channels
join `simple_discussions` on simple_discussions.channel_id = channels.id
where simple_discussions.created_at >= '2013-01-01' and simple_discussions.created_at <= '2013-12-30'
group by channels.id) as a on a.channel_id = channels.id
left join
(select name, channels.id as channel_id, count(*) as num from channels
join `video_attachments` on video_attachments.channel_id = channels.id
<h1>Test1</h1>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<textarea style="width: 500px; height: 500px;">
</textarea>
<a href="#">Test1</a>
<script>
$("a").click(function(e){
var test = "?name=";
for(var i=0; i<8155; i++){
<h1>Test</h1>
<? echo strlen($_GET["name"]) ?>
@joecannatti
joecannatti / gist:6225360
Created August 13, 2013 20:29
Bash one liner to show what percentage of total commits in a codebase where made by all committers.
git log | grep ^Author | awk '{print $NF}' | sort | uniq -c | sort | awk "{print (\$1/$(git log | grep ^Author | wc -l)) \" \" \$2
@joecannatti
joecannatti / gist:7219927
Last active December 26, 2015 21:59
talk
Ruby is a complex programming language. It’s power comes from the richness and flexibility of the language’s features.
There’s so many cool and interesting bits to ruby, that sometimes we don’t take the time to fully grok them all.
It’s possible to use a Ruby feature everyday, but not really understand how it works.
In this talk, we’ll dig deep into 5 of the most commonly misunderstood aspects of programming in Ruby.
Geared mostly towards newer Ruby devs, but there’ll certainly be something for everyone!
* Code evaluation time
* Methods called while defining a class (attr_accessor, has_many, etc)
backup-sys ()
{
sudo tar cvfJ backup.tar.xz --exclude={/dev/*,/proc/*,/sys/*,/tmp/*,/run/*,/mnt/*,/media/*,/lost+found,/data} /;
gpg --encrypt --recipient "Joe Cannatti" backup.tar.xz;
mv backup.tar.xz.gpg dropbox/Dropbox/;
rm -rf backup.tar.xz
}
feature 'logged-in homepage', js: true do
# AWFUL HACK SO THAT WE DON'T GO INTO THE NEW VIEW AUTOMATICALLY
# IF THIS ISN'T HERE (TRY IT!), THE LOGIN TAKES THE USER TO THE
# /SHIPMENTS/SCHEDULE AUTOMATICALLY, WHICH THEN CALLS BRAINTREE FOR
# SOME INFORMATION. WE DON'T CARE ABOUT THAT YET, SO I AM BLOCKING IT
# OUT. WE WILL CARE ABOUT IT SOMEDAY SOON.
before :all do
@old_shipment = ShipmentsController
common: &common
adapter: postgresql
encoding: unicode
pool: 5
username: stitchfix_owner
password: stitchfix_owner
host: localhost
min_messages: warning
development: