Skip to content

Instantly share code, notes, and snippets.

View adamcaron's full-sized avatar

Adam Caron adamcaron

View GitHub Profile
@adamcaron
adamcaron / stateManagement.md
Last active May 8, 2020 19:42
State Management in React

State Management in React

Before understanding the concept of state management, you have to realize what a state is. A state in this context is the data layer of your application. When it comes to React and the libraries that help it manage state, you can say that state is an object that contains the data that your application is dealing with. For instance, if you want to display a list of items on your app, your state will contain the items you intend to display. State influences how React components behave and how they are rendered. Yes! It is as simple as that.

State management, therefore, means monitoring and managing the data (i.e., the state) of your app. Almost all apps have state in one way or the other and, as such, managing state has become one of the most important parts of building any modern app today.

Source: https://auth0.com/blog/managing-the-state-of-react-apps-with-mobx/

@adamcaron
adamcaron / MissingInteger.js
Last active February 13, 2020 17:35
First crack at Codility demo test
// This is a demo task.
// Write a function:
// function solution(A);
// that, given an array A of N integers, returns the smallest positive integer (greater than 0) that does not occur in A.
// For example, given A = [1, 3, 6, 4, 1, 2], the function should return 5.
@adamcaron
adamcaron / tidy-up.markdown
Last active September 12, 2015 22:06 — forked from rwarbelow/tidy-up.markdown
Posse Tidy-Up Duties

Tasks

Classrooms

  • wipe down tables
  • remove cups and other kitchenware
  • wipe surfaces of public screens (TVs, pairing monitors)
  • tidy up cords at the front of each classroom

Pairing Stations and Group Setups

  • wipe down tables
@adamcaron
adamcaron / how_to_lern_good.markdown
Last active September 17, 2015 22:33
Lightning Talk Notes for Thurs. 9/17/15

How to Lern Good.

Here's a tool that can help you learn. It's called Pivotal Tracker.

  • It's a convenient place to hold all your notes.
  • It's (more importantly) easy to find old notes (easier than a notebook
  • It's free.

How's it work?

Step 1. Plan our day.

@adamcaron
adamcaron / form_helpers.markdown
Last active August 29, 2015 14:27
How params are nested depending on `form_for` and `form_tag`

reference project: form_playground/app/views/new.html.erb

form_for

form_for is useful for POST requests because it stores the params in a hash related to the object, @article.

form_for(@article) do |f|
  <%= f.label :title %>
  <%= f.text_field :title %>
  <%= f.label :body %>
  <%= f.text_area :body %>
@adamcaron
adamcaron / authorization_my_jams.markdown
Last active September 16, 2015 01:02
Step by step -- Adding Authorization for our My Jams app

Authorization for My Jams

Let's make it so an admin can see a list of all the users.

Write the test

touch test/integration/admin_users_test.rb ... In class, Mike helped us setup admin_categories_test.rb. Since this is 'My Jams', we may not be concerned with 'categories'. Instead, we'll make it so admins see a list of all the users (so perhaps an admin can change the role of a user or delete a user).

require 'test_helper'

class AdminUsersTest &lt; ActionDispatch::IntegrationTest
@adamcaron
adamcaron / where_programming_ends_and_ui_design_begins.markdown
Last active August 29, 2015 14:26
Lightening Talk Outline (Week of 7/27)

Where Programming Ends & UI Begins

1. The Struggle is Real

You wouldn't ...

  • To create a master woodwork, a carpenter wouldn't just grab some wood and start nailing it together
  • So too is it inappropriate to jump into the css file and start playing around with background colors

Respect that feeling in your guy

  • When you go to "style the page"
@adamcaron
adamcaron / Personal Homepage
Last active August 29, 2015 14:24
Create a Personal Homepage
Putting your information on a website under yourname.com is worth it just to have some real estate on the web and make it easier for hiring managers to
- find you,
- learn about you, and
- get in touch with you.
# Elevator Pitch
Right off the bat, when people land on your site, you want them to understand
- who you are,
- what you do, and
- what you’re looking for.
@adamcaron
adamcaron / 99_bottles_of_beer.rb
Created May 26, 2015 14:49
99 Bottles of Beer on the Wall
# Write a program that "sings" the classic,
# "99 Bottles of Beer on the Wall".
# start at 100 and use the .downto enumerator
for i in (100).downto(0)
if i > 1
puts "#{i} Bottles of Beer on the Wall,
#{i} Bottles of Beer... take one down, pass it around,"
elsif i == 1