Skip to content

Instantly share code, notes, and snippets.

View gildardoperez's full-sized avatar

Gil Perez gildardoperez

  • Los Angeles
View GitHub Profile
@gildardoperez
gildardoperez / RAILS_CHEATSHEET.md
Created November 8, 2020 08:05 — forked from mdang/RAILS_CHEATSHEET.md
Ruby on Rails Cheatsheet

Ruby on Rails Cheatsheet

Architecture

Create a new application

Install the Rails gem if you haven't done so before

@gildardoperez
gildardoperez / gist:58414851772543afb1576a439b171033
Created March 3, 2020 05:24 — forked from carolineschnapp/gist:9122054
Shopify Wholesale Order form to use in a page or collection template.
{% comment %}
Source: https://gist.github.com/carolineschnapp/9122054
If you are not on a collection page, do define which collection to use in the order form.
Use the following assign statement, replace 'your-collection-handle-here' with your collection handle.
{% assign collection = collections.your-collection-handle-here %}
Use the assign statement outside of this comment block at the top of your template.
{% endcomment %}
{% paginate collection.products by 100 %}
@gildardoperez
gildardoperez / gist:bcefacbc05c80731eae44ee20c51e848
Last active January 6, 2020 17:39 — forked from nateberkopec/gist:5714795
Fixing your Nokogiri config
# IF NOKOGIRI 1.5.X OR LOWER
gem uninstall nokogiri libxml-ruby
brew update
brew uninstall libxml2
brew install libxml2 --with-xml2-config
brew install libxslt
bundle config --global build.nokogiri "--with-xml2-include=/usr/local/Cellar/libxml2/2.9.1/include/libxml2"
bundle
@gildardoperez
gildardoperez / README.md
Created September 29, 2019 21:08 — forked from joyrexus/README.md
curl tutorial

An introduction to curl using GitHub's API.

Basics

Makes a basic GET request to the specifed URI

curl https://api.github.com/users/caspyin

Includes HTTP-Header information in the output

@gildardoperez
gildardoperez / .gitattributes
Created May 8, 2019 19:31 — forked from iloveitaly/.gitattributes
Snippets for Spree Commerce Development
# with my git configuration the spree repo was giving me issues with line endings
# this fixed the issue for me: marking a file as binary causes git to ignore it completely
core/vendor/assets/javascripts/jquery.alerts/jquery.alerts.css.erb binary
core/vendor/assets/javascripts/jquery.alerts/jquery.alerts.js binary
core/vendor/assets/javascripts/jquery.jstree/themes/apple/style.css binary
sample/db/sample/spree/line_items.yml binary
sample/db/sample/spree/products.yml binary
@gildardoperez
gildardoperez / cors.config
Created February 18, 2019 22:01 — forked from djpate/cors.config
Add CORS to a ruby app with nginx in Elastic Beanstalk(EBS)
#This should be in ebextensions
container_commands:
01setup_cors:
command: "ruby .ebextensions/cors.rb"
02reload_nginx:
command: "service nginx reload"
@gildardoperez
gildardoperez / 01_add_cors.config.yaml
Created February 17, 2019 21:35 — forked from vsviridov/01_add_cors.config.yaml
Add CORS to Nginx on AWS Elastic Beanstalk
container_commands:
01_fix_static_cors:
command: "/tmp/fix_static_cors.sh"
files:
"/tmp/fix_static_cors.sh":
mode: "000755"
owner: root
group: root
content: |
#!/bin/bash
@gildardoperez
gildardoperez / restart_bluetooth.sh
Created January 27, 2019 21:35 — forked from nicolasembleton/restart_bluetooth.sh
Restart Bluetooth Daemon on Mac OS X without restarting
#!/bin/bash
sudo kextunload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport
sudo kextload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport
@gildardoperez
gildardoperez / _form.html.erb
Created January 21, 2019 22:22 — forked from mklickman/_form.html.erb
Basic Rails Contact Form and Mailer
<%= form_for(@contact) do |f| %>
<% if @contact.errors.any? %>
<div id="error_explanation">
<h3><%= pluralize(@contact.errors.count, "error") %> prohibited this contact from being saved:</h2>
<ul>
<% @contact.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
@gildardoperez
gildardoperez / ffmpeg screen sharing
Created January 21, 2019 05:27 — forked from cbarraco/ffmpeg screen sharing
The poor man's VNC. If you have ffmpeg and netcat you can stream your screen across your network with two one-liners
# If the server has ffmpeg:
## For the server:
ffmpeg -f fbdev -i /dev/fb0 -f avi pipe:1 | nc -l -p 1234
## For the viewer:
nc 127.0.0.1 1234 | ffplay -i pipe:0
# If the server doesn't have ffmpeg:
## For the server:
sudo cat /dev/fb0 | nc -l -p 1234
## For the viewer (replace 1920x1080 with the server's resolution):