Skip to content

Instantly share code, notes, and snippets.

The Task
Convert an entire folder of RAW images, typically produced by DSLR camera at 300dpi and convert them all to web-ready, 72dpi JPEG's in a single bash command while utilizing all eight threads in parallel on a quad-core i5 CPU.
OS X Prerequesites
Install ImageMagick with RAW support via Homebrew.
If you don't already have Homebrew, shame on you. Grab it like so:
@mariochavez
mariochavez / testing_front_end_rspec_capybara.md
Created January 10, 2018 20:04 — forked from juliocesar/testing_front_end_rspec_capybara.md
Testing front-end for a Sinatra app with RSpec and Capybara

Testing front-end for a Sinatra app with RSpec and Capybara

I've used Cucumber quite a bit on my last job. It's an excellent tool, and I believe readable tests are the way to the future. But I could never get around to write effective scenarios, or maintain the boatload of text that the suite becomes once you get to a point where you have decent coverage. On top of that, it didn't seem to take much for the suite to become really slow as tests were added.

A while ago I've seen a gist by Lachie Cox where he shows how to use RSpec and Capybara to do front-end tests. That sounded perfect for me. I love RSpec, I can write my own matchers when I need them with little code, and it reads damn nicely.

So for my Rails Rumble 2010 project, as usual, I rolled a Sinatra app and figured I should give the idea a shot. Below are my findings.

Gemfile

@mariochavez
mariochavez / my_app.ex
Created September 29, 2017 18:50 — forked from alanpeabody/my_app.ex
Websockets in Elixir with Cowboy and Plug
defmodule MyApp do
use Application
def start(_type, _args) do
import Supervisor.Spec, warn: false
children = [
Plug.Adapters.Cowboy.child_spec(:http, MyApp.Router, [], [
dispatch: dispatch
])
@mariochavez
mariochavez / after.rb
Created March 25, 2017 04:20 — forked from mperham/after.rb
Thread-friendly shared connection
class ActiveRecord::Base
mattr_accessor :shared_connection
@@shared_connection = nil
def self.connection
@@shared_connection || ConnectionPool::Wrapper.new(:size => 1) { retrieve_connection }
end
end
ActiveRecord::Base.shared_connection = ActiveRecord::Base.connection
@mariochavez
mariochavez / migration.md
Created February 6, 2017 17:30
RSpec to Minitest

These are the scripts that I used to migrate from RSpec to Minitest in a Rails aplication.

It is expected for the test suite to be in RSpec 3.x sintax.

  1. Install rename library from Homebrew
  2. Remove RSpec/TestUnit from Gemfile
  3. Add minitest-rails gem
  4. Rename spec forder to test
  5. Add a test_helper.rb file
@mariochavez
mariochavez / info.md
Created October 28, 2016 17:31
Postgresql
@mariochavez
mariochavez / GIF-Screencast-OSX.md
Created September 13, 2016 20:47 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@mariochavez
mariochavez / ml-ruby.md
Created May 13, 2016 19:06 — forked from gbuesing/ml-ruby.md
Resources for Machine Learning in Ruby

Resources for Machine Learning in Ruby

Gems

To circle.yml:
dependencies:
post:
- bin/cisetup
checkout:
post:
- git fetch origin --depth=1000000
@mariochavez
mariochavez / rails_load_path_tips.md
Created December 29, 2015 00:27 — forked from maxim/rails_load_path_tips.md
How to use rails load paths, app, and lib directories.

In Rails 3

NOTE: This post now lives (and kept up to date) on my blog: http://hakunin.com/rails3-load-paths

If you add a dir directly under app/

Do nothing. All files in this dir are eager loaded in production and lazy loaded in development by default.

If you add a dir under app/something/