Skip to content

Instantly share code, notes, and snippets.

Mitch VanDuyn catmando

Block or report user

Report or block catmando

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@catmando
catmando / gist:096c29d0fb06873ad978
Last active Sep 27, 2017
Carrierwave Custom Version
View gist:096c29d0fb06873ad978
class CustomUploader < CarrierWave::Uploader::Base
# complete example of custom carrierwave version generator that does not use manipulate with hopefully helpful comments
# in this case we are uploading a .psd (photoshop file) and then rendering to a png. We want to
# save the original psd, so we create a png version.
storage :file
version :png do # tells carrierwave to generate a new version of the upload in this case a "png"
@catmando
catmando / gist:d283739ef34e9368518c
Created Jun 15, 2015
Changing opal-rspec directory (useful if you cannot upgrade to opal-rails > 7.0)
View gist:d283739ef34e9368518c

opal-rspec does not currently have a means to change the spec directory location, which you really need to do if you are going to have mixed opal and regular (server) ruby code testing.

The following assumes normal specs will go into the the spec directory, and opal specs will go into spec-opal directory.

To get this to work, you have to change the Opal::Server path to end with spec-opal instead of spec which is what opal-rspec normally does. Then you have to change the Opal::Server main file (the sprockets_runner.rb.erb) file to be a copy which pulls in your specs.

In your rake file do this:

require 'opal/rspec/rake_task'
View ajjahn_git_work_process.txt
git pull # Start with latest upstream
git checkout -b myfeature # Do some work in a separate branch
git add the_file
git commit -m 'blah blah blah' # Make as many commits as needed
# Fetch and rebase when finished (or as often as you want before pushing local changes)
git fetch master # Get any new upstream changes that may have been pushed
git rebase master # Plop my commits on top of master/resolve any conflicts
git checkout master
git merge myfeature
git push
@catmando
catmando / thinking-in-react-1.rb
Last active Dec 20, 2015
Thinking In React - Code Slice 1 in Ruby
View thinking-in-react-1.rb
class ProductCategoryRow < React::Component::Base
param :category, type: String
def render
tr { th(colSpan: 2) { params.category } }
end
end
class ProductRow < React::Component::Base
@catmando
catmando / remote_puts.rb
Last active Dec 20, 2015
simple opal remote_require test
View remote_puts.rb
puts 'yes I seem to have been required!'
@catmando
catmando / test-react-rb-spa.html
Last active Dec 21, 2015
Test React.rb editable single page app file
View test-react-rb-spa.html
<!DOCTYPE html>
<!--[if IE]><![endif]-->
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Inline Reactive Ruby Demo</title>
<script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
<script src="inline-reactive-ruby.js" />
View Issue873WithDelay
^CJanBearsAire:v4-catprint mitch$ DRIVER=wk bundle exec rspec spec/integration/home_spec.rb
Finished "EnableLogging()" with response "Success()"
Wrote response true ""
Received "SetTimeout(-1)"
Started "SetTimeout(-1)"
Finished "SetTimeout(-1)" with response "Success()"
Wrote response true ""
Received "Visit(http://127.0.0.1:55292/session/new?return_to=/)"
Started "Visit(http://127.0.0.1:55292/session/new?return_to=/)"
Load started
View issue873withshortdelay
^CJanBearsAire:v4-catprint mitch$ DRIVER=wk bundle exec rspec spec/integration/home_spec.rb
Finished "EnableLogging()" with response "Success()"
Wrote response true ""
Received "SetTimeout(-1)"
Started "SetTimeout(-1)"
Finished "SetTimeout(-1)" with response "Success()"
Wrote response true ""
Received "Visit(http://127.0.0.1:55368/session/new?return_to=/)"
Started "Visit(http://127.0.0.1:55368/session/new?return_to=/)"
Load started
@catmando
catmando / fail.log
Created Mar 10, 2016
Intermittent Puffing Billing Failure
View fail.log
Started GET "/drafts/new/pro/1/job_type" for 127.0.0.1 at 2016-03-08 21:58:11 -0500
Processing by DraftsController#new as HTML
Parameters: {"other"=>"new/pro/1/job_type"}
ProductionCenter Load (2.2ms) SELECT `production_centers`.* FROM `production_centers` WHERE (domain_aliases LIKE '%127.0.0.1\n%') ORDER BY `production_centers`.`id` ASC LIMIT 1
ProductionCenter Load (0.6ms) SELECT `production_centers`.* FROM `production_centers` WHERE `production_centers`.`domain` = '127.0.0.1' LIMIT 1
[[[ Production Center: Test Production Center: /Users/mitch/railsdev/v4-catprint/app/views/home ]]]
* Locale set to 'en'
* using US Time Format
(0.5ms) SELECT COUNT(*) FROM `papers`
Paper Load (1.5ms) SELECT `papers`.* FROM `papers` WHERE `papers`.`production_center_id` = 1 AND `papers`.`is_active` = 1 ORDER BY `papers`.`display_order` ASC
@catmando
catmando / Reactrb-test-setup.md
Last active May 24, 2016
Adding Specs to Opal / React.rb Gems
View Reactrb-test-setup.md

Add development dependencies to .gemspec

  # your-gem.gemspec
  
  s.add_development_dependency 'reactive-ruby' # only if not already a dependency
  s.add_development_dependency 'rake'
  s.add_development_dependency 'rspec-rails', '3.3.3'
  s.add_development_dependency 'timecop'
  s.add_development_dependency 'opal-rspec', '0.4.3'
  s.add_development_dependency 'sinatra'
You can’t perform that action at this time.