Skip to content

Instantly share code, notes, and snippets.

View chyld's full-sized avatar
:electron:
import numpy

Chyld Medford chyld

:electron:
import numpy
View GitHub Profile
# encoding: utf-8
class PhotoUploader < CarrierWave::Uploader::Base
# Include RMagick or MiniMagick support:
include CarrierWave::RMagick
# include CarrierWave::MiniMagick
# Include the Sprockets helpers for Rails 3.1+ asset pipeline compatibility:
# include Sprockets::Helpers::RailsHelper
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require 'rspec/autorun'
require 'capybara/rspec'
require 'database_cleaner'
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
RSpec.configure do |config|
config.before(:suite) do
***RSPEC***
Equivalence
actual.should eq(expected) # passes if actual == expected
actual.should == expected # passes if actual == expected
actual.should eql(expected) # passes if actual.eql?(expected)
Identity
actual.should be(expected) # passes if actual.equal?(expected)
actual.should equal(expected) # passes if actual.equal?(expected)
http://xavura.github.com/CoffeeScript-Sublime-Plugin/
@chyld
chyld / ruby2.0.sh
Last active December 15, 2015 08:19
installing ruby 2.0 and rails 4.0
\curl -L https://get.rvm.io | bash -s stable
rvm requirements
brew update
brew tap homebrew/dupes
brew upgrade
# can omit apple-gcc42 if xode and command line tools are installed
brew install autoconf automake apple-gcc42 libtool pkg-config openssl readline libyaml sqlite libxml2 libxslt libksba
ActionMailer::Base.add_delivery_method :ses, AWS::SES::Base, :access_key_id => ENV['AWSKEY'], :secret_access_key => ENV['AWSSEC']
Rails.configuration.stripe = {
:publishable_key => ENV['STRIPE_PUB'],
:secret_key => ENV['STRIPE_SEC']
}
Stripe.api_key = Rails.configuration.stripe[:secret_key]
%script{:src => "https://checkout.stripe.com/v2/checkout.js",
:class => "stripe-button",
:'data-label' => product.name,
:'data-amount' => product.cost * 100,
:'data-key' => Rails.configuration.stripe[:publishable_key]}
= form_tag purchase_product_path(product), :remote => true do end
JSON.parse(string)
xhr = new XMLHttpRequest()
xhr.open('GET', 'URL', is_async)
xhr.responseType = 'arraybuffer'; // binary data
xhr.onload(fn)
xhr.send()
@chyld
chyld / gist:6503415
Created September 10, 2013 00:27
Sublime Text Settings
// Settings in here override those in "Default/Preferences.sublime-settings",
// and are overridden in turn by file type specific settings.
{
"font_face": "Source Code Pro Light",
"font_size": 13,
"tab_size": 2,
"translate_tabs_to_spaces": true,
"trim_trailing_white_space_on_save": true,
"save_on_focus_lost": true
}