Skip to content

Instantly share code, notes, and snippets.

View TSMMark's full-sized avatar
🐶

Mark Allen TSMMark

🐶
View GitHub Profile
@TSMMark
TSMMark / main.md
Last active August 29, 2015 14:21
Heading Anchors in GFM

Single hash

[Link to the Single hash](#single-hash).

Link to the Single hash.

Double hash (with parens)

[Link to the Double hash with parens](#double-hash-with-parens).

@TSMMark
TSMMark / basic_pasta_spec.rb
Last active August 29, 2015 14:18
pasta spec examples
describe Pasta do
describe "#sauce_name" do
describe "when initialized with sauce_type = 2" do
let(:pasta) { Pasta.new(2) }
it "returns \"pesto\"" do
assert_equal(pasta.sauce_name, "pesto")
end
end
end
@TSMMark
TSMMark / Delegator.js
Created October 7, 2014 16:48
Demplate
var $ = require("jQuery")
, Delegator
;
Delegator = function () {
this.$el = $("<p/>");
}
// Add a function to the object that delegates to a property on the same object.
//
def sent?
self.status == "sent"
end
@TSMMark
TSMMark / s3.rb
Last active March 4, 2022 20:17
Process a remote CSV with SmarterCSV (also example with Paperclip and Amazon S3 AWS)
# this is the code I used to determine the csv_path to use when using Paperclip with Amazon S3 AWS
# necessary because my development environment doesn't upload to S3
# get an object that has_attachment with Paperclip
object = ModelWithPaperclip.last
# use url if no file exists at path
csv_path = File.exists?(object.csv.path) ? object.csv.path : object.csv.url
# this should probably be implemented as a model method