Skip to content

Instantly share code, notes, and snippets.

View sicktastic's full-sized avatar
:octocat:
I may be slow to respond.

Anthony Lee sicktastic

:octocat:
I may be slow to respond.
View GitHub Profile
@sicktastic
sicktastic / Procfile.dev
Created April 12, 2021 21:54 — forked from joshuaclayton/Procfile.dev
Rails Procfile.dev for Tailwind + live reloading of views
web: bundle exec puma -C config/puma.rb
webpack: bin/webpack-dev-server
livereload: watchexec -w app/views touch app/javascript/packs/application.js
@sicktastic
sicktastic / gist:005a3ccd4debaba6e911d9044ed6328e
Created February 17, 2021 03:04 — forked from arjunvenkat/gist:1115bc41bf395a162084
Seeding a Rails database with a CSV file

How to seed a Rails database with a CSV file

1. Setup

First, Create a folder inside of lib called seeds

Put your CSV file example.csv into the lib/seeds folder. In the example below, the file is called real_estate_transactions.csv

Make sure you've created a resource with the appropriate columns to match your seed data. The names don't have to match up.

@sicktastic
sicktastic / notion2blog.js
Created February 2, 2021 08:39 — forked from mayneyao/notion2blog.js
Notion.so > Personal Blog | custom domain + disqus comment
const MY_DOMAIN = "agodrich.com"
const START_PAGE = "https://www.notion.so/gatsby-starter-notion-2c5e3d685aa341088d4cd8daca52fcc2"
const DISQUS_SHORTNAME = "agodrich"
addEventListener('fetch', event => {
event.respondWith(fetchAndApply(event.request))
})
const corsHeaders = {
"Access-Control-Allow-Origin": "*",

Cheat Sheets are greate but they are not a substitute for learning the framework and reading the documentation as we most certainly have not covered every potential example here. Please refer to the Rails Command Line Docs for more information.

Command Line Generator Info

Reference

You can get all of this information on the command line.

rails generate with no generator name will output a list of all available generators and some information about global options. rails generate GENERATOR --help will list the options that can be passed to the specified generator.

@sicktastic
sicktastic / move_heroku_pg_to_aws_rds.md
Created February 7, 2020 21:57 — forked from halilim/move_heroku_pg_to_aws_rds.md
Move Heroku Postgres to Amazon AWS RDS
  1. Prepare your RDS instance and [authorize access to it][1] (basically make it public).

  2. Put your app in maintenance mode:

    heroku maintenance:on
  3. Save the latest SQL dump of the DB:

@sicktastic
sicktastic / nginx-passenger-ssl.conf
Created March 26, 2019 16:30 — forked from rkjha/nginx-passenger-ssl.conf
Nginx/Passenger config when using SSL with a Ruby/Rails Application.
# for redirecting hhtp traffic to https version of the site
server {
listen 80;
server_name example.com;
return 301 https://$server_name$request_uri;
}
# for redirecting to non-www version of the site
server {
listen 80;
@sicktastic
sicktastic / countries
Created February 5, 2018 07:06 — forked from kalinchernev/countries
Plain text list of countries
Afghanistan
Albania
Algeria
Andorra
Angola
Antigua & Deps
Argentina
Armenia
Australia
Austria
@sicktastic
sicktastic / countries
Created February 5, 2018 07:06 — forked from kalinchernev/countries
Plain text list of countries
Afghanistan
Albania
Algeria
Andorra
Angola
Antigua & Deps
Argentina
Armenia
Australia
Austria
@sicktastic
sicktastic / HOWTO.md
Created February 26, 2017 13:44 — forked from cvan/HOWTO.md
How to serve a custom HTTPS domain on GitHub Pages with CloudFlare: *FREE*, secure and performant by default

Instructions

CloudFlare is an awesome reverse cache proxy and CDN that provides DNS, free HTTPS (TLS) support, best-in-class performance settings (gzip, SDCH, HTTP/2, sane Cache-Control and E-Tag headers, etc.), minification, etc.

  1. Make sure you have registered a domain name.
  2. Sign up for CloudFlare and create an account for your domain.
  3. In your domain registrar's admin panel, point the nameservers to CloudFlare's (refer to this awesome list of links for instructions for various registrars).
  4. From the CloudFlare settings for that domain, enable HTTPS/SSL and set up a Page Rule to force HTTPS redirects. (If you want to get fancy, you can also enable automatic minification for text-based assets [HTML/CSS/JS/SVG/etc.], which is a pretty cool feature if you don't want already have a build step for minification.)
  5. If you
@sicktastic
sicktastic / doc.md
Created February 16, 2017 20:01 — forked from oelmekki/doc.md
Rails + Browserify + React + es7

1. Gemfile

gem 'browserify-rails', '1.5.0' # until fix: https://github.com/browserify-rails/browserify-rails/issues/101
gem 'react-rails'

Browserify-rails allows to use browserify within assets pipeline. React-rails is here only to allow to use #react_component (and thus, prerendering).

Note that jquery-rails can be removed from Gemfile, the npm version of jquery and jquery-ujs will be used instead.