Skip to content

Instantly share code, notes, and snippets.

View javierav's full-sized avatar
😎

Javier Aranda javierav

😎
View GitHub Profile
@fernandoaleman
fernandoaleman / mysql2-mojave.md
Last active February 7, 2024 19:19
Install mysql2 on MacOS Mojave

For MacOS Catalina, visit Install mysql2 on MacOS Catalina

Problem

Installing mysql2 gem errors on MacOS Mojave.

Solution

Make sure openssl is installed on Mac via Homebrew.

@SylarRuby
SylarRuby / downloads_controller.rb
Last active August 25, 2022 06:43
Loop through all, zip and download from ActiveStorage
# In our gemfile:
# gem 'rubyzip'
require 'zip'
# private ?
def process_and_create_zip_file
# Simulation of an object with has_many_attached :documents
job = Job.first.documents
# Tmp folder to store the download files from S3
@alexey
alexey / README_AA_CC_AASM.md
Last active August 7, 2020 08:34
ActiveAdmin + CanCan + AASM event switcher with AJAX

About:

Inspired by activeadmin_addons and its Enum Integration I want to make similar functionality for AASM by letting users change events depending on their abilities and available events/statuses in model.

Sorry i have no time to create an addon right now for this gem but i will try to do it soon. Feel free to modify, use it and integrate. Ask me any question if you need!

Prequestites:

Gem: ActiveAdmin,

@zthxxx
zthxxx / Activate Office 2019 for macOS VoL.md
Last active April 25, 2024 01:09
crack activate Office on mac with license file
@javivelasco
javivelasco / reactive-2015.md
Last active October 2, 2022 16:36
Proposal for lightning talk at Reactive Conf 2015

I’m amazed by React and how it’s bringing happiness to our developer lives. I specially like the workflow that integrates Webpack + React + CSS Modules + Babel among other tools and preprocessors. That’s why Javier Jiménez and I are working together in a library called React Toolbox that we would like to show in a lightning talk at Reactive Conference.

The main idea is to create a set of React components implementing Material Design guidelines. There are already some libraries that solve a similar problem but our project is mostly focused on the workflow and best practices to create a tool everybody would want to use. Also, we are sticking to the design guidelines proposed by Google and embracing minimalism by generating the minimum possible amount of HTML and styles to get the best result. Our workflow includes among others:

  • Webpack.
  • ES6 with Babel
  • Unit t
@maxivak
maxivak / readme.md
Last active January 12, 2024 06:53
Integrating Gem/Engine and Main Rails App
@tristanm
tristanm / README.md
Last active March 10, 2024 20:11
Migrating a Rails project from MySQL to PostgreSQL

Migrating a Rails project from MySQL to PostgreSQL

This brief guide is written from my own experience with migrating a large (~5GB) MySQL database to PostgreSQL for a Rails project.

No warranties, guarantees, support etc. Use at your own risk and, as always, ENSURE YOU MAKE BACKUPS FIRST!

I chose [pgloader][1] because it's extremely fast. YMMV.

  1. Replace mysql2 gem with pg in Gemfile.
  2. Update config/database.yml for PostgreSQL. I used [Rails' template][2] as a starting point.
@kevcha
kevcha / Explanations.md
Last active July 6, 2019 03:33
Rails 4 view resolvers

The problem

Using multiple namespaces will require to have also namespaces views. For exemple, if you have an Admin namespace, with a Admin::ProjectsController with a show action that also exists in non namespaced ProjecsController, you cannot render views/projects/show.html.erv from Admin::ProjecsController.

What we want to do

The researched behavior is to try to render the views/admin/projects/show.html.erb, and, if it doesn't exist, fallback to views/projects/show.html.erb

The solution

@ekristen
ekristen / check_docker_container.sh
Last active January 16, 2024 16:15
Bash Script for Nagios to Check Status of Docker Container
#!/bin/bash
# Author: Erik Kristensen
# Email: erik@erikkristensen.com
# License: MIT
# Nagios Usage: check_nrpe!check_docker_container!_container_id_
# Usage: ./check_docker_container.sh _container_id_
#
# Depending on your docker configuration, root might be required. If your nrpe user has rights
# to talk to the docker daemon, then root is not required. This is why root privileges are not
@branneman
branneman / better-nodejs-require-paths.md
Last active April 25, 2024 13:21
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

const Article = require('../../../../app/models/article');

Those suck for maintenance and they're ugly.

Possible solutions