Skip to content

Instantly share code, notes, and snippets.

@sebasjimenez10
sebasjimenez10 / reset_mysql_root_pwd.md
Last active October 14, 2016 14:27
Resting MySQL Root Password

Resetting MySQL root user password on Mac ( OSX El Capitan 10.11.x )

  1. System Preferences > MySQL > Stop MySQL Server
  2. From a terminal: sudo /usr/local/mysql/bin/mysqld_safe --skip-grant-tables
  3. From a new terminal: sudo /usr/local/mysql/bin/mysql -u root
  4. From mysql> FLUSH PRIVILEGES;
  5. From mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'NEWPASSOWORD';
  6. From mysql> \q
  7. Stop server
  8. Start server
gem install eventmachine -- --with-cppflags=-I/usr/local/opt/openssl/include
# Building native extensions with: '--with-cppflags=-I/usr/local/opt/openssl/include'
# This could take a while...
# Successfully installed eventmachine-1.0.8
# 1 gem installed
# You can also set up bundler like this but I think that is superficial
bundle config build.eventmachine --with-cppflags=-I/usr/local/opt/openssl/include
# And then run
@sebasjimenez10
sebasjimenez10 / array_flattener.rb
Created November 14, 2017 23:53
Array Flattener Implementation
# frozen_string_literal: true
# ArrayFlattener provides a method called `flatten_array` which returns a flat array
# from an array of nested arrays.
class ArrayFlattener
# The method uses a local variable
# as a memory object and passes it
# to the recursive method `recursive_flatten`
def flatten_array(arr)
result = []
recursive_flatten(arr, result)
@sebasjimenez10
sebasjimenez10 / sublime-linter-config.json
Last active May 9, 2018 20:43
Sublime linter config reference
// SublimeLinter Settings - User
{
"linters": {
"rubocop": {
"enable": false,
"executable": "/Users/sebastian/.rbenv/shims/ruby",
"args": ["--config", "./.rubocop.yml"],
"use_bundle_exec": true
},
"ruby": {
@sebasjimenez10
sebasjimenez10 / dockerizing-rails.md
Last active September 27, 2018 17:30
Dockerizing existing Rails App

Dockerizing an existing Rails App

I've been working on a small rails application and I've been wondering about the best way to have a development environment almost as identical as the production environment this app would run on. There are a few ways that I've seen around this, like normalizing environments by vendoring all the gems, setting ruby version files, versioning every gem you use in the Gemfile (which is a VERY recommended practice by the way). But all of this revolves around the rails project itself. We should also keep in mind all the things that affect our project, like the db version we use, if we use redis, or any other external service.

This is why I decided to give a try to docker, since in my experience I've always installed and bundled my apps directly on my machine.

Here are some of the things I learned in the process.

Installing Docker

Keybase proof

I hereby claim:

  • I am sebasjimenez10 on github.
  • I am sebasjimenez10 (https://keybase.io/sebasjimenez10) on keybase.
  • I have a public key ASBL1oCpdd9w-zYFCnCNZkldkHNttuZ06f2tXetRYelUMgo

To claim this, I am signing this object: