Skip to content

Instantly share code, notes, and snippets.

View JoseMPena's full-sized avatar
🎯
Focusing

JoseMPena JoseMPena

🎯
Focusing
View GitHub Profile
@JoseMPena
JoseMPena / README.md
Created January 29, 2025 10:25 — forked from abelcallejo/README.md
Creating bootable Linux USB using Mac

Creating bootable Linux USB using Mac

mac

CentOS, Ubuntu, Slackware, etc. Whatever Linux-based OS it is, you can create a bootable USB for it by using a Mac.

1. Prepare the .iso file

Download it, copy it, whatever it takes to prepare that Linux-based OS .iso file

2. Convert the .iso file into a .img.dmg

@JoseMPena
JoseMPena / git_cheatsheet.md
Last active July 11, 2024 20:48
Git Cheatsheet
  1. git config Purpose: Configure Git settings, such as user name and email.

Example: git config --global user.name "Your Name"

  1. git init Purpose: Initialize a new Git repository.

Example: git init

@JoseMPena
JoseMPena / Capybara.md
Created November 10, 2023 14:46 — forked from tomas-stefano/Capybara.md
Capybara cheatsheet

Capybara Actions

# Anchor
click_link 'Save'

# Button
click_button 'awesome'

# Both above
@JoseMPena
JoseMPena / rails-jsonb-queries
Created November 6, 2023 14:38 — forked from mankind/rails-jsonb-queries
Ruby on Rails-5 postgresql-9.6 jsonb queries
http://stackoverflow.com/questions/22667401/postgres-json-data-type-rails-query
http://stackoverflow.com/questions/40702813/query-on-postgres-json-array-field-in-rails
#payload: [{"kind"=>"person"}]
Segment.where("payload @> ?", [{kind: "person"}].to_json)
#data: {"interest"=>["music", "movies", "programming"]}
Segment.where("data @> ?", {"interest": ["music", "movies", "programming"]}.to_json)
Segment.where("data #>> '{interest, 1}' = 'movies' ")
Segment.where("jsonb_array_length(data->'interest') > 1")
@JoseMPena
JoseMPena / rover_challenge.md
Created August 11, 2022 11:16
Mars Rover Challenge

Coding Problem

Instructions

  • Please read carefully the challenge and if you have any doubt or need extra info please don't hesitate to ask us before starting.
  • Design, test, develop and document the code. It should be a performant, clean and well structured solution. Then send us a link or a zip with a git repo.
  • You should consider this code ready for production as it were a PR to be reviewed by a colleague. Also commit as if it were a real assignment.
  • Your experience level will be taken into consideration when evaluating.
  • Sumit your solution as a private repository, giving us access so we can evaluate

The problem

@JoseMPena
JoseMPena / free_elixir_deploy.md
Created July 15, 2021 08:24
Optimizing for free hosting elixir deployments

Another way to deploy Elixir apps UPDATE: This article now uses an all-Elixir deployment strategy, instead of the Nginx reverse proxy strategy it had originally. There are A LOT of different ways to deploy Elixir/Phoenix applications. I want to fill a gap in the current literature: how do you deploy a Phoenix web app to a single Linux server optimizing for cost effectiveness, control, and simplicity, while using modern Elixir tools like releases to achieve zero-downtime deploys without hot code upgrading? I’m going to walk through a deployment strategy that can take you start-to-finish with a full-featured Phoenix web app running on a free-forever Google Cloud Platform Compute Engine instance. This setup is completely free, and when you have more traffic the cost of scaling on raw GCP instances is a lot cheaper than on platform-as-a-service offerings (Heroku, Gigalixir, Render, Fly, etc). And, you’re in full control of the system so you don’t have to work around any fixed limitations. Scaling can be as simple

@JoseMPena
JoseMPena / rails_console_schema.txt
Created November 11, 2020 10:20
Using rails console to manipulate schema
2.3.1 :001 > class SchemaMigration < ActiveRecord::Base; self.primary_key = :version; end
=> :version
class SchemaMigration < ActiveRecord::Base; self.primary_key = :version; end
2.3.1 :002 > SchemaMigration.first
SchemaMigration Load (2.1ms) SELECT "schema_migrations".* FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC LIMIT 1
=> #<SchemaMigration version: "20160727113335">
@JoseMPena
JoseMPena / Buttons_Template.js
Created August 4, 2020 10:36 — forked from Anshul0305/Buttons_Template.js
Facebook Code Snippets
{
"facebook":{
"attachment":{
"type":"template",
"payload":{
"template_type":"button",
"text":"What do you want to do next?",
"buttons":[
{
"type":"web_url",
@JoseMPena
JoseMPena / Flexible Dockerized Phoenix Deployments.md
Created March 31, 2020 11:56 — forked from jswny/Flexible Dockerized Phoenix Deployments.md
A guide to building and running zero-dependency Phoenix (Elixir) deployments with Docker. Works with Phoenix 1.2 and 1.3.

Prelude

I. Preface and Motivation

This guide was written because I don't particularly enjoy deploying Phoenix (or Elixir for that matter) applications. It's not easy. Primarily, I don't have a lot of money to spend on a nice, fancy VPS so compiling my Phoenix apps on my VPS often isn't an option. For that, we have Distillery releases. However, that requires me to either have a separate server for staging to use as a build server, or to keep a particular version of Erlang installed on my VPS, neither of which sound like great options to me and they all have the possibilities of version mismatches with ERTS. In addition to all this, theres a whole lot of configuration which needs to be done to setup a Phoenix app for deployment, and it's hard to remember.

For that reason, I wanted to use Docker so that all of my deployments would be automated and reproducable. In addition, Docker would allow me to have reproducable builds for my releases. I could build my releases on any machine that I wanted in a contai

@JoseMPena
JoseMPena / gist:174eb909c7740c8b724dce9563710427
Created November 13, 2018 11:21 — forked from nruth/gist:1264245
Shared Capybara (or model setup) helpers for RSpec and Cucumber
# Let's assume you're driving Capybara in both RSpec request specs & Cucumber,
# for example you're using Cucumber as a design/documentation tool, and RSpec
# for the more boring integration tests.
# You don't want to duplicate your click-this-click-that helpers to e.g.
# log_in(username, password).
# You may also have model state setup code which can be shared/reused.
# Where can it go? How can it be loaded? I've been using the following approach:
#