Skip to content

Instantly share code, notes, and snippets.

View luisguzman02's full-sized avatar
🎯
Focusing

Luis luisguzman02

🎯
Focusing
View GitHub Profile
@luisguzman02
luisguzman02 / configmap.yaml
Created April 12, 2023 17:35 — forked from jferris/configmap.yaml
Rails Kubernetes Manifests
apiVersion: v1
kind: ConfigMap
metadata:
name: example
namespace: default
data:
APPLICATION_HOST: example.com
LANG: en_US.UTF-8
PIDFILE: /tmp/server.pid
PORT: "3000"
@luisguzman02
luisguzman02 / base_controller.rb
Created October 7, 2021 16:19 — forked from dhoelzgen/base_controller.rb
CORS in Rails 4 APIs
class API::V1::BaseController < ApplicationController
skip_before_filter :verify_authenticity_token
before_filter :cors_preflight_check
after_filter :cors_set_access_control_headers
def cors_set_access_control_headers
headers['Access-Control-Allow-Origin'] = '*'
headers['Access-Control-Allow-Methods'] = 'POST, GET, PUT, DELETE, OPTIONS'
@luisguzman02
luisguzman02 / modern_js.md
Created August 23, 2021 02:52 — forked from gaearon/modern_js.md
Modern JavaScript in React Documentation

If you haven’t worked with JavaScript in the last few years, these three points should give you enough knowledge to feel comfortable reading the React documentation:

  • We define variables with let and const statements. For the purposes of the React documentation, you can consider them equivalent to var.
  • We use the class keyword to define JavaScript classes. There are two things worth remembering about them. Firstly, unlike with objects, you don't need to put commas between class method definitions. Secondly, unlike many other languages with classes, in JavaScript the value of this in a method [depends on how it is called](https://developer.mozilla.org/en-US/docs/Web/Jav
@luisguzman02
luisguzman02 / Gemfile
Created June 28, 2020 05:41 — forked from dhh/Gemfile
HEY's Gemfile
ruby '2.7.1'
gem 'rails', github: 'rails/rails'
gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data
# Action Text
gem 'actiontext', github: 'basecamp/actiontext', ref: 'okra'
gem 'okra', github: 'basecamp/okra'
# Drivers
module Filterable
extend ActiveSupport::Concern
included do
scope :filtered, ->(values) {
current = all
filters.each do |key, method|
if values.try(:key?, key) && current.respond_to?(method)
current = current.send(method, values[key])
end

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@luisguzman02
luisguzman02 / .hyper.js
Created May 29, 2019 18:57 — forked from robertcoopercode/.hyper.js
Hyper Configuration
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// Choose either "stable" for receiving highly polished,
// or "canary" for less polished but more frequent updates
updateChannel: 'stable',
@luisguzman02
luisguzman02 / gist:ed237850705ef352ee6a8d5b4f9e5334
Created May 17, 2019 18:05 — forked from brianburridge/gist:11298396
How to load MySQL time zone tables from Mac OS time zone files

The easiest way to load the Mysql Time Zone tables from your Mac OS time zone fields is via this command:

mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root mysql

However, on many systems like mine that will fail because some of the time zone information is incompatible with the database schema for the time zone tables.

Therefore, you'll want to load the time zone information into a text file and edit it to only include the time zones you need. (Or, attempt to find the data breaking the import.)

mysql_tzinfo_to_sql /usr/share/zoneinfo > zone_import.sql
@luisguzman02
luisguzman02 / Capybara.md
Created July 25, 2018 17:06 — forked from tomas-stefano/Capybara.md
Capybara cheatsheet

Capybara Actions

# Anchor
click_link 'Save'

# Button
click_button 'awesome'

# Both above
@luisguzman02
luisguzman02 / change_eb_ruby_version.sh
Created June 9, 2018 19:54 — forked from januszm/change_eb_ruby_version.sh
Change Ruby minor version in AWS Elastic Beanstalk
# Currently (2017/2018) it's not possible to change the Ruby 'minor' version (eg. 2.3 => 2.4) using the web console
# However, it's possible using the 'awscli' tool.
brew install awscli # pip install awscli
aws elasticbeanstalk update-environment \
--solution-stack-name "64bit Amazon Linux 2017.09 v2.6.1 running Ruby 2.4 (Puma)" \
--environment-name "myappenv1" --region "us-east-2"