Skip to content

Instantly share code, notes, and snippets.

View csaunders's full-sized avatar

Christopher Saunders csaunders

View GitHub Profile
source 'https://rubygems.org'
gem 'shopify_theme'
@csaunders
csaunders / changelog.md
Created November 4, 2013 15:43
Shopify Theme gem changelog

v0.0.11

  • Locks JSON api version which fixed an issue with downloading large binary files -- Tyler Ball
  • Respect API limits when downloading theme assets from Shopify API -- Chris Saunders

Text Editor

The software we'll be using for remote programming has plugins for the following text editors:

  • Emacs
  • Sublime Text
  • Vim

Sublime text allows you to use it for free, with a nag screen; otherwise you can use the online text editor that comes with floobits. The onine editor is alright.

cancelChanges: ->
model = @get('model')
if transaction = model.get('transaction')
transaction.rollback()
else
alert "Could not roll back changes"
@set('isEditing', false)
[11:28:41] <csaunders> maybe you can leverage increment/decrement?
[11:29:09] <csaunders> items = Item.where(query)
[11:29:31] <csaunders> value > 0 ? items.increment(value) : items.decrement(value)
[11:29:33] <csaunders> ¯\(°_o)/¯
[11:29:57] <csaunders> also I think my syntax is wrong :/
[11:30:09] <csaunders> but those might have an answer
[11:31:08] <csaunders> keep in mind, increment/decrement don't fire callbacks…
@csaunders
csaunders / posts.js.coffee
Created September 28, 2013 13:17
Why am I getting the error Uncaught TypeError: Object post has no method '_create' when trying to create a new post?
Blember.Post = DS.Model.extend
title: DS.attr('string'),
isCompleted: DS.attr('boolean')
Blember.Post.FIXTURES = [
{
id: 1,
title: 'Hello World',
body: 'This is my first post',
isCompleted: true
@csaunders
csaunders / my_fancy_test.rb
Created September 16, 2013 21:47
The way I try to drive my TDD
class MyFancy
end
describe "MyFancy" do
it "should be able to be very fancy"
it "should be possible to set my level of fancy"
it "should add a number of exclamation points equal to the fancy level"
@csaunders
csaunders / buildctags.rb
Created August 8, 2013 15:06
A script that I have run via cron to re-index various codebases.
#!/usr/bin/ruby
places_to_process = ["~/development/ruby/"].map{|dir| File.expand_path(dir)}
places_to_process.each do |directory|
Dir.chdir(directory)
entries = Dir.entries(".").reject{|i| i.chars.first == "."}
entries.each do |entry|
Dir.chdir(directory + "/" + entry)
system("ctags -R -f .tags")
end
@csaunders
csaunders / nginx.conf
Created August 8, 2013 04:24
Really confused as to why my nginx 403's when visiting / instead of redirecting to /brews
upstream brewwatcher_server {
server 127.0.0.1:4567 fail_timeout=0;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
@csaunders
csaunders / module_inclusion.rb
Created May 17, 2013 15:00
What are your thoughts on using this style for ensuring modules are able to be included at the top of the file? Is there something in the Ruby runtime I'm missing that would cause this to break?
module AddsFunctionality
extend ActiveSupport::Concern
alias_method :foo, :baz
end
def baz
puts "Hello Baz"
end
end