Skip to content

Instantly share code, notes, and snippets.

View dpickett's full-sized avatar

Dan Pickett dpickett

View GitHub Profile
@dpickett
dpickett / fetch-in-rails-config.md
Created April 26, 2018 20:49
Fetch in Rails Config

Fetch in Rails Config

Once Rails is probably configured in our Rails application, we are not out of the jungle yet. We will also need to properly configure our applications such that our fetch requests communicate effectively with Rails. Let's briefly touch on these:

Rails Options

Rails has built in securities and config that make it very selective about the requests that are allowed to come in. We'll need to edit our controller configuration to allow fetch requests and their json formats so that we can respond accordingly.

require 'date'
class Officiant
def authorized?
is_minister_of_the_gospel? || willing_to_get_ordained_online?
end
def available?(date)
!not_really_interested && !busy?(date) && !generally_too_busy
end
# Path to your oh-my-zsh installation.
export ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="robbyrussell"
# Uncomment the following line to use case-sensitive completion.
@dpickett
dpickett / 0_reuse_code.js
Created December 30, 2013 15:57
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
<div class="not_found">
<img src="/images/not_found_overlay.png" alt="Not found dude"/>
<img src="/images/troggles/eddie.png" alt="" />
</div>
where troggles/*baddy*.png is a randomized array of
eddie, helpers, bashful, workers, smarties