Skip to content

Instantly share code, notes, and snippets.

View mdarby's full-sized avatar
💭
pending validation

Matt Darby mdarby

💭
pending validation
View GitHub Profile
# This is a total hack
# For some reason, somewhere in the murky depths of the CCW
# lies some code that makes ActionMailer's :date header act
# like a Date instead of a DateTime. Since Date isn't aware of Time
# :date looks like "Thu, 03 Mar 2011 00:00:00 +0000" instead of
# "Thu, 03 Mar 2011 13:52:57 -0500".
#
# Since we're in EST (-5 GMT), email clients subtract five hours from
# "midnight" (in this case), so all emails look like they were sent/received
# "yesterday at 7pm".
# This is a total hack
# For some reason, somewhere in the murky depths of the CCW
# lies some code that makes ActionMailer's :date header act
# like a Date instead of a DateTime. Since Date isn't aware of Time
# :date looks like "Thu, 03 Mar 2011 00:00:00 +0000" instead of
# "Thu, 03 Mar 2011 13:52:57 -0500".
#
# Since we're in EST (-5 GMT), email clients subtract five hours from
# "midnight" (in this case), so all emails look like they were sent/received
# "yesterday at 7pm".
source 'http://rubygems.org'
gem 'rails'
gem 'haml'
gem 'jquery-rails'
gem 'devise'
gem 'inherited_resources'
gem 'hoptoad_notifier'
gem 'paperclip'
gem 'aws-s3'
Knockout | JMVC | Backbone
Hours Spent: 10 3 5
Documentation: B B C
Frustration Level: 6 3 9
MVC: N Y Y
MVVM: Y N N
Opinionated Rank: 2 1 3
$('document').ready(function(){
var slider = {
visible: ko.observable(false),
toggle: function(){
if(this.visible()){
this.hide();
this.visible(false);
} else {
this.show();
#!/bin/bash
mount_point=/mnt/offsite
backup_device=/dev/sda1
log=/var/log/offsite_backup.log
mount $backup_device $mount_point
if df | grep -q $mount_point
then
# The resource I use to upload to the server is named ExternalDownload. I upload to the server,
# insert a new DJ queue entry that calls this bit of code that lives in config/initializers.
require 'aws/s3'
class FileUploader
attr_accessor :external_download_id, :s3_config
def initialize(external_download_id)
s3_config_path = RAILS_ROOT + '/config/amazon_s3.yml'
restful_acl_test_app_rails3
/* On page load… */
$('document').ready(function(){
/* Disable all submit buttons when form submitted */
$(":form").submit(function(){
$(":submit").attr({"disabled": true, "value": "Working…"});
});
$(window).bind("ajaxSend", function(){
$("#spinner").show();
function showTweets(){
var target = $("#twitter");
var url = "http://twitter.com/statuses/user_timeline/USERNAME.json?callback=?&count=5"
var tweets = new Array();
target.html("Loading Tweets...");
$.getJSON(url, function(data) {
target.html("");