Skip to content

Instantly share code, notes, and snippets.

@kjs222
kjs222 / rails_setup.md
Created December 2, 2016 22:27 — forked from ryanflach/rails_setup.md
Common setup for a new Rails project
  1. rails new <project_name> -d postgresql --skip-turbolinks --skip-spring -T
  • -d postgresql sets up the project to use PostgreSQL
  • --skip-turbolinks & --skip-spring creates a project that does not use turbolinks or spring
  • -T skips the creation of the test directory and use of Test::Unit
  1. In the Gemfile:
  • Available to all environments:
    • gem 'figaro' - store environment variables securely across your app (docs)
    • Uncomment gem 'bcrypt', '~> 3.1.7' if you will be hosting your own user accounts with passwords (docs)
  • Inside of group :test:
    • gem 'rspec-rails' - user rspec in place of minitest (docs)

#Make a heat map graphic with D3.js

This gist contains the code to create a simple "heat map" with D3.js. In this case, the "heat map" is a graph showing activity distributed over the days of the week on one axis and the weeks of the year on the other.

This gist is meant to be used as part of a workshop where the code is uncommented as the workshop progresses.

It could also be used as a puzzle outside of a workshop: follow the clues to reconstruct the correct code and make it work!

In the end, the chart should look something like this:

Deliverable

  • Read [Node.js, Require and Exports][rblog] and [Organize Your Code with RequireJS][rblog2]
  • Fork This Gist
  • Respond in your forked gist with answers to the following questions

In the context of Node, what is a module?

##Hello World My code: here

  • Responder #1 (here) - This person took the same approach but did not use the ternary operator. She used a single if statements to handle the situation where input was provided. There are two return statements - one on the if and one without a condition.

  • Responder #2 (here) - This person used a memoization type technique to handle whether input was provided or not. This is a valid approach, but is less intuitive (imo) than using a conditional.

  • Responder #3 (here) - I like the classical use of the if/else in this response. I think it's the most intuitive. I think the use of .length on the input is superfluous.

  • Responder #4 (here) - t

Length Points Week
15 minutes 5 Week 1

ES6 Research

Throughout the module (and your journey to Google enlightenment while working on IdeaBox2.0) you may notice a few different ways that JavaScript code is being written.

That might have something to do with something called ES6 and ES5

@kjs222
kjs222 / postgresql_practice_exercises.md
Last active April 25, 2024 17:06
PostgreSQL Practice Exercises
@kjs222
kjs222 / postgresql_practice_samples.md
Last active August 30, 2016 15:12
PostgreSQL Practice Samples

###Setup:

  1. Clone Repo:
git clone git@github.com:turingschool-examples/storedom.git
bundle update
  1. Change database from sqlite to Postgres (requires changes to gemfile and database.yml). Bundle again.
Time Monday Tuesday Wednesday Thursday Friday
8:00-8:40 SQL Deliberate Practice Active Record Deliberate Practice SQL Deliberate Practice Rails Deliberate Practice SQL Deliberate Practice
8:40-10:00 Ruby Deliberate Practice JS/JQ Deliberate Practice Ruby Deliberate Practice JS/JQ Deliberate Practice Ruby Deliberate Practice
10:00-12:00 Stats Hadoop (3 wks)
R (3 wks)
Stats (2 wks)
Databases (2 wks)
Stats(2 wks)
Hadoop (3 wks)
R (3 wks)
Stats
1:00-2:00 Project Career Exploration Project Career Exploration Project
2:00-5:00 Project Project Project Project Project

###SQL/Postgres - Resources/Activities

Submitting your work: Keep a gist with the queries you write.

  • SELECT sum(revenue) FROM items;
  • SELECT ROUND(avg(revenue),2) FROM items;
  • SELECT min(revenue) FROM items;
  • SELECT max(revenue) FROM items;
  • SELECT count(*) FROM items WHERE name IS NOT null;
  • SELECT * FROM items WHERE course = 'main';
  • SELECT name FROM items WHERE course = 'main';
@kjs222
kjs222 / Wed_AM_Lesson_Notes.md
Last active May 28, 2016 14:52
Wed AM Lesson Notes

Rails Helpers

Reviewed 7 Crud Actions:

  1. Read: get /tasks (rails controller/action tasks#index)
  2. Read: get /tasks/:id (rails controller/action tasks#show)
  3. Create: get /tasks/new (rails controller/action tasks#new)
  4. Create: post /tasks (rails controller/action tasks#create)
  5. Update: get /tasks/:id/edit (rails controller/action tasks#edit)
  6. Update: put /tasks/:id (rails controller/action tasks#update)