Skip to content

Instantly share code, notes, and snippets.

View jelaniwoods's full-sized avatar

Jelani Woods jelaniwoods

View GitHub Profile
# Query/use custom command for `git`.
zstyle -s ":vcs_info:git:*:-all-" "command" _omz_git_git_cmd
: ${_omz_git_git_cmd:=git}
#
# Functions
#
# The name of the current branch
# Back-compatibility wrapper for when this function was defined here in

Keybase proof

I hereby claim:

  • I am jelaniwoods on github.
  • I am jelaniwoods (https://keybase.io/jelaniwoods) on keybase.
  • I have a public key ASArUR3pGxX1QQ4w6eRuLkwkSc6-f3QVEAWO4S7qggDrBQo

To claim this, I am signing this object:

@jelaniwoods
jelaniwoods / dates.md
Last active March 21, 2019 20:57 — forked from raghubetina/dates.md
Dates Cheatsheet

Dates Cheatsheet

In this guide, I'll show you how I prefer to handle dates.

We'll

  1. use a gem called Chronic to intelligently parse a wide variety of user input into valid Dates,
  2. I'll also show you a gem that helps create nice looking datepicker controls,
  3. look at some built-in Ruby/Rails methods that help us format dates and times nicely for our users to look at.
address = "Chicago, IL"
expect($stdout).to receive(:puts).with("Enter your street address:")
allow(STDIN).to receive(:gets).and_return(address )
expect($stdout).to receive(:puts).with("Okay, getting the weather forecast for #{address}...")
expect($stdout).to receive(:puts).with(/Your latitude is -*\d+.\d+/)
expect($stdout).to receive(:puts).with(/Your longitude is -*\d+.\d+/)
expect($stdout).to receive(:puts).with(/Current temperature: -*\d+.\d+/)
expect($stdout).to receive(:puts).with(/Current summary: \w+\s*/)
expect($stdout).to receive(:puts).with(/For the next few minutes: \w+\s*/)
runs = 0
runs_path = ".setup_runs"
if !File.exist?(runs_path)
system! "touch " + runs_path
system! "echo '0' > " + runs_path
runs = open(runs_path).read.to_i
else
runs = open(runs_path).read.to_i
cmd = "echo '#{runs + 1}' > " + runs_path
system! cmd
@jelaniwoods
jelaniwoods / setup-fork-windows.md
Last active August 22, 2019 17:23
Instructions on how to setup Fork on Windows 10

Setup Fork for Windows

Download and Install Fork

Download Git?

Edit Git Line Ending Settings

In Fork select console

fork-console

Fixing your User table

If you had previously generated your User model with the rails generate draft:devise command here are some steps you should take to resolve

Step 1

navigate to /git and make a commit.

Step 2

In the db/migrate/ folder, look for the file with "create_devise_users" in the name and open it.

devise-create-users

Google Maps in Rails

Assuming you have an API key

Step 1

Add these gems to your Gemfile

gem 'gmaps4rails'
gem 'underscore-rails' 
@jelaniwoods
jelaniwoods / msm-devprime
Last active October 30, 2019 16:57
contents for a dev.rake file that contains dummy data
This file has been truncated, but you can view the full file.
namespace(:dev) do
desc "Hydrate the database with some dummy data to look at so that developing is easier"
task({ :prime => :environment}) do
Director.delete_all
director_values = [
{id: 1, dob: "January 28, 1959", name: "Frank Darabont", bio: "Three-time Oscar nominee Frank Darabont was born in a refugee camp in 1959 in Montbeliard, France, the son of Hungarian parents who had fled Budapest during the failed 1956 Hungarian revolution. Brought to America as an infant, he settled with his family in Los Angeles and attended Hollywood High School. His first job in movies was as a production assistant on the 1981 low-budget film, Hell Night (1981), starring Linda Blair. He spent the next six years working in the art department as a set dresser and in set construction while struggling to establish himself as a writer. His first produced writing credit (shared) was on the 1987 film, A Nightmare on Elm Street 3: Dream Warriors (1987), directed by Chuck Russell. Darabont is one of only six filmmake

Routing Basics

Connect the RCAV dots

RCAV (Route Controller Action View)

Route

In the config/routes.rb file we define routes using the get method.

get takes two arguments.

The first is a String that is the path in the URL that you want to define (”/home”, for example)