Skip to content

Instantly share code, notes, and snippets.

@danielpcox
danielpcox / Gemfile
Created February 12, 2012 23:08
A minimal Sinatra app deployable to Heroku.
source :rubygems
gem "sinatra"
@danielpcox
danielpcox / wp_downloader.rb
Created January 17, 2012 22:57
Quick-and-dirty script to download and stitch together the Washington Post, sans Sports.
#!/home/danielpcox/.rvm/rubies/ruby-1.9.3-p0/bin/ruby
# ############# The Washington Post Downloader #############
#
# Downloads and merges the day's Epaper into three sections. Ignores the Sports section.
# (requires pdftk, wget, and the nokogiri gem)
require 'open-uri'
require 'nokogiri'
@danielpcox
danielpcox / pidgin_manipulator.rb
Created October 22, 2011 19:10
Set Your Pidgin Status With Ruby and DBus
#!/usr/bin/env ruby
#
require "dbus"
session_bus = DBus::SessionBus.instance
# Get the Pidgin Service
pidgin_dbus = session_bus.service("im.pidgin.purple.PurpleService")
# Get the object from this service
1. e4 c6
2. Bc4 d5
3. Bd3 e5
4. Nf3 Bg4
5. Nc3 Nd7
6. exd5 Bb4
7. Qe2 c5
8. Nb5 h5
9. a3 h4
10. axb4 f6
Testing again
Testing, testing, 1, 2, 3...
@danielpcox
danielpcox / parameters_in_dryml.dryml
Created September 16, 2011 22:28
Parametrized Tags In DRYML
<!-- defining a tag -->
<def tag="messages">
<br /><br />
<ul>
<li param="msg1">Message 1</li>
<li param="msg2">Message 2</li>
<li param="msg3">Message 3</li>
</ul>
</def>
@danielpcox
danielpcox / rmt.rb
Created April 16, 2011 02:33
Generates my ORIE 3800 HW5 homework (database connection code omitted)
#!/home/danielpcox/.rvm/rubies/ruby-1.9.2-p180/bin/ruby
require 'active_record'
require './ticket'
require './extra'
require './show_info'
require 'gruff'
conn_params = {
@danielpcox
danielpcox / _items.html.erb
Created July 13, 2010 22:58
a DRY and unobtrusive way to use will_paginate with ajax via jQuery
<!-- app/views/items/_items.html.erb -->
<ul>
<% items.each do |item| %>
<li><%= item.name %></li>
<% end %>
</ul>
<%= ajax_will_paginate items, :update => 'my_items_list' %>
alias g='gvim --remote-silent'
alias fri='ri'
alias lh='ls --color=always -lasth | less -R'
alias be='bundle exec'
alias gr='grep -r --color'
alias rm='gvfs-trash'