This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| source 'http://rubygems.org' | |
| gem 'rails', '3.2.0' | |
| # Bundle edge Rails instead: | |
| # gem 'rails', :git => 'git://github.com/rails/rails.git' | |
| gem 'mysql2'# , '~> 0.2.7' | |
| gem 'devise' #, '~> 1.1.3' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 1,one | |
| 2,two | |
| 3,three | |
| 4,four | |
| 5,five | |
| 6,six | |
| 7,seven | |
| 8,eight | |
| 9,nine | |
| 10,ten |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'spec_helper' | |
| describe "home" do | |
| before do | |
| @domain = "myshop.myshopify.com" | |
| @token = SecureRandom.hex(16) | |
| @shopify_session = ShopifyAPI::Session.new(@domain, @token) | |
| end | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| aaronmcleod@MacBook-Pro $ rvm ruby-1.9.2-p290 | |
| aaronmcleod@MacBook-Pro $ bundle exec rspec spec | |
| ................................................*...... | |
| Pending: | |
| CopyProcess::Processor#compile_files_to_element_types | |
| # No reason given | |
| # ./spec/copyprocess/processor_spec.rb:222 | |
| Finished in 1.55 seconds |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class CharityProductDeleteJob < Struct.new(:charity_id, :shop_id) | |
| def perform | |
| charity = Charity.find(charity_id) | |
| shop = Shop.find(shop_id) | |
| ShopifyAPI::Base.site = shop.api_url | |
| products = ShopifyAPI::Product.find(:all, params: { handle: "#{charity.handle}-charity" }) | |
| unless products.blank? | |
| Rails.logger.debug "Destroy product" | |
| products.each { |p| p.destroy } | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Wrapper | |
| def self.wrap(string, column_to_wrap) | |
| recursive_wrap(string.reverse.scan(/\S+\s?/), column_to_wrap).reverse | |
| end | |
| def self.recursive_wrap(array, column) | |
| head = array[0] | |
| if head.scan(/.{1,#{column}}/).length > 1 | |
| head = head.strip.reverse.scan(/.{1,#{column}}/).collect{ |c| c.reverse }.reverse.join("\n") | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Note = Backbone.Model.extend({}) | |
| NoteView = Backbone.View.extend({ | |
| el: null, | |
| initialize: -> | |
| this.model.view = this | |
| $('.view').append("<div class=\"note\" id=\"note_#{this.model.get('id')}\"><a>X</a><p>#{this.model.get('body')}</p><cite>#{this.model.get('author')}</cite></div>") | |
| this.el = $("#note_#{this.model.get('id')}") | |
| self = this | |
| this.el.children('a').click -> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'mathn' | |
| require 'csv' | |
| def to_rad(angle) | |
| angle/180 * Math::PI | |
| end | |
| def get_distance(from, to) | |
| earth_radius = 6371 | |
| dLat = to_rad(to.first - from.first) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /tmp/temp_textmate.J8yW2j:139:in /bin/bash: -c: line 0: unexpected EOF while looking for matching `'' | |
| /bin/bash: -c: line 1: syntax error: unexpected end of fileto_a' for "sdfd":String (NoMethodError) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'mathn' | |
| require 'csv' | |
| def to_rad(angle) | |
| angle/180 * Math::PI | |
| end | |
| def get_distance(from, to) | |
| earth_radius = 6371 | |
| dLat = to_rad(to.first - from.first) |