Skip to content

Instantly share code, notes, and snippets.

View joecannatti's full-sized avatar

Joe Cannatti joecannatti

View GitHub Profile
namespace :responsys do
desc 'download and import Responsys events from FTP'
task load: :environment do
Resque.enqueue(LoadEventsJob)
end
Our Fields, unique key
RIID, (CUSTOMER_ID_, EMAIL_)
RIID, (CUSTOMER_ID_, EMAIL_)
imgs=`find . -name \*.jpg | head -5`
img_args=$(for i in $imgs; do echo -n " -a $i "; done)
echo $'Hey Grandpa, \nI wrote a computer program to send you 5 pictures of Ari everyday until you\'re caught up. \nI think it\'s more fun to get 5 a day then to get them all at once.\nSorry you weren\'t on the list to begin with.' | \
mutt -s "Daily Ari Photos" $img_args -- [email protected] [email protected]
for i in $imgs; do
mv $i sent
done
common: &common
adapter: postgresql
encoding: unicode
pool: 5
username: stitchfix_owner
password: stitchfix_owner
host: localhost
min_messages: warning
development:
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
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
}
@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)
@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
<h1>Test</h1>
<? echo strlen($_GET["name"]) ?>
<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++){
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