Skip to content

Instantly share code, notes, and snippets.

View creaturenex's full-sized avatar
🏠
Working from home

Oscar Romero creaturenex

🏠
Working from home
View GitHub Profile
@creaturenex
creaturenex / image_processing-on-heroku.md
Created December 2, 2022 00:21 — forked from bigtiger/image_processing-on-heroku.md
How We Deployed Image Processing to Heroku in Support of a Rails 6 Application

How We Deployed Image Processing to Heroku in Support of a Rails 6 Application

Our app was already deployed and working on Heroku with MiniMagick. There were a few features of Image Processing that were appealing, performance and autorotation, and it appeared to be a straightforward swap.

Locally, we had run brew install vips on our MacBooks to get it running. That was early in the process and a detail long forgotten. When I deployed to Heroku @juliancheal pointed out that the staging environment was failing with an ActiveSupport::MessageVerifier::InvalidSignature error.

We were able to quickly identify the missing libvips dependency.

Figuring out how to install libvips to support rubyvips to support Image Processing was not trivial and therefore this guidepost exists.

@creaturenex
creaturenex / gist:b8fbe5783e838a4e4260278ce3f9ae46
Last active December 1, 2022 19:25
shopify coding challenge
def solution(number)
case
when number % 5 == 0 && number % 3 == 0 then "FizzBuzz"
when number % 5 == 0 then "Buzz"
when number % 3 == 0 then "Fizz"
else
number
end
end
@creaturenex
creaturenex / ExportKindle.js
Created May 9, 2022 15:46 — forked from jkubecki/ExportKindle.js
Amazon Kindle Export
// The following data should be run in the console while viewing the page https://read.amazon.com/
// It will export a CSV file called "download" which can (and should) be renamed with a .csv extension
var db = openDatabase('K4W', '3', 'thedatabase', 1024 * 1024);
getAmazonCsv = function() {
// Set header for CSV export line - change this if you change the fields used
var csvData = "ASIN,Title,Authors,PurchaseDate\n";
db.transaction(function(tx) {
You have an application that uses a #fetch method to retrieve a collection of data from some external source and a #save method that saves any modified data when you finish. To make updates easier, you have several methods that update the data based on different search criteria. So far, you have something like this:
Copy Code
def update_data(select_string, block)
data = fetch(select_string)
data.each # you can update or replace this line
save(data)
end
def update_by_type(type) # you can update this method
@creaturenex
creaturenex / space_invader.rb
Created February 18, 2021 01:14
space_invader
class Invader
def initialize
self.animate
end
def down
puts " ▒▒ ▒▒"
puts " ▒▒ ▒▒"
puts " ▒▒▒▒▒▒▒▒▒▒▒▒▒▒"
puts " ▒▒▒▒ ▒▒▒▒▒▒ ▒▒▒▒"