Skip to content

Instantly share code, notes, and snippets.

View timstephenson's full-sized avatar

Tim Stephenson timstephenson

  • F5
  • Ashland Oregon
View GitHub Profile
@timstephenson
timstephenson / attachment_spec.rb
Created September 5, 2012 21:53
Attachment test with CarrierWave
require File.dirname(__FILE__) + '/../spec_helper'
require 'carrierwave/test/matchers'
describe Attachment do
include CarrierWave::Test::Matchers
it "should be valid" do
Attachment.new.should be_valid
end
class AttachmentUploader < CarrierWave::Uploader::Base
# Include RMagick or ImageScience support:
# include CarrierWave::RMagick
# include CarrierWave::ImageScience
# Choose what kind of storage to use for this uploader:
# storage :file
storage :fog
@timstephenson
timstephenson / gist:5207709
Last active December 15, 2015 05:19
Hi Geoffrey Here's a simple category on NSDictionary for making JSON requests and converting data.
#import <Foundation/Foundation.h>
@interface NSDictionary (JSONCategory)
+ (NSDictionary*)dictionaryWithContentsOfJSONURLString: (NSString*)url;
- (NSData*)toJSON;
- (void)pushToURLString: (NSString *)urlString method:(NSString *)method delegate: (id)delegate;
@end
#import "NSDictionary+JSONCategory.h"
@timstephenson
timstephenson / gist:5356742
Last active December 16, 2015 01:39
Example of how we would change Watchdog to use SendGrid
' Each worker currently uses Net.Mail.SmtpClient to drop the message into the IIS outgoing mail directory.
' For SendGrid we would change the code below as follows:
If oSmtpClient Is Nothing Then
oSmtpClient = New System.Net.Mail.SmtpClient
oSmtpClient.DeliveryMethod = Net.Mail.SmtpDeliveryMethod.PickupDirectoryFromIis
End If
oSmtpClient.Send(oEmail)
' With SendGrid this would become:
@timstephenson
timstephenson / config-data.js
Last active December 17, 2015 13:19
DVR Offer Something like this might work... I had already put a little thought into it, I hope you don't mind.
runDealRules: function(){
this.freeDVRForExistingCustomers();
this.kmaBoxPricing();
this.showPaqueBundlesIfQualified();
this.txKMABundlesSwap();
this.freeDVRForDirectSalesExludingTX();
},
// If the environment is direct sales and there is no tx offer,
// Add the free DVR offer.
<!-- This isn't really a big deal, but if this html: -->
<table cellpadding="0" cellspacing="0"
border="0" align="left" width="310" height=
"105" class=
"border-bottom-mobile fill-width-mobile feature-hero-area"
style="width:310px">
<tr>
<td style="padding-left: 10px;" class=
"pad-bottom-mobile no-left-padding-mobile">