Skip to content

Instantly share code, notes, and snippets.

View iscott's full-sized avatar

Ira Herman iscott

View GitHub Profile
@iscott
iscott / gist:e88616c9c0f1422e1ae3
Created August 7, 2014 03:45
Web Wrapper App
import UIKit
class ViewController: UIViewController {
@IBOutlet var webView: UIWebView!
@IBAction func goBack(sender: AnyObject) {
webView.goBack()
}
@iscott
iscott / item_spec.rb
Created March 2, 2015 18:37
Testing scopes with RSPEC
require 'rails_helper'
RSpec.describe Item, :type => :model do
before(:each) do
@purchased_item = Item.create(
:name => "Item1",
:qty => 1,
:is_purchased => true
)
#RPS Lab Requirements
* Web Page/Web App that lets you play Rock Paper Scissors
* 2 Players (on the same screen)
* Win Logic (Tells the user who won)
* Custom styling (Fonts, Background, Images)
* Pictures for Rock, Paper, and Scissors
##Super Optional Bonus Challenge
* Play vs Computer (AI)
@iscott
iscott / simple_authentication_rails_5_bcrypt_and_has_secure_password.md
Last active November 14, 2024 10:54
Cheat Sheet: Simple Authentication in Rails 5 with has_secure_password

Cheat Sheet: Simple Authentication in Rails 6 with has_secure_password

The goal of this cheatsheet is to make it easy to add hand-rolled authentication to any rails app in a series of layers.

First the simplest/core layers, then optional layers depending on which features/functionality you want.

Specs
AUTHOR Ira Herman
LANGUAGE/STACK Ruby on Rails Version 4, 5, or 6
@iscott
iscott / mean_app.md
Last active September 11, 2018 05:10
MEANbean Full MEAN stack CRUD app cheatsheet

Cheat Sheet: MEANbean coffee shop

A cheatsheet by Ira Herman

Specs
AUTHOR Ira Herman
LANGUAGE/STACK Node JS 6.x/MEAN Stack
OUTCOME A full stack MEAN application with CRUD actions
@iscott
iscott / Javascript functions and conditionals using (){}, and semicolons.md
Last active June 7, 2017 21:54
Javascript functions and conditionals using (){}, and semicolons cheatsheet

Javascript functions and conditionals using (){}, and semicolons

CURLY BRACES:

Curly braces {} almost always indicate a block of code. { means START } means END

Keywords like

@iscott
iscott / atom_packages.md
Created May 17, 2018 17:18
My Recommended Atom Packages and Theme to make Atom a Fully-Featured Editor

Atom Packages & Notes

This document will recommend some of my favorite packages (plugins, add-ons, whatever you want to call them...they're awesome) for the Atom text editor. These give atom many of the features of a full IDE (Integrated Development Environment).

Atom Website

To browse & install packages, (in the menu bar) go to Atom >> Preferences >> Install and search for your desired package. Click install. That's it!

There are links to the package documentation from the Atom site. You can also view instructions on how to use each package from the packages menu Atom >> Preferences >> Packages

Run Server:

python3 manage.py runserver

Create DB:

createdb <dbname>

Make migrations:

python3 manage.py makemigrations

Migrate DB:

@iscott
iscott / 00-intro-to-hooks.md
Created March 24, 2020 17:03
Intro to React Hooks

React Hooks

Intro to Hooks

Hooks were introduced in React Version 16.8.

Before hooks, all state needed to be within a Class component. Class components come with a lot of boilerplate, which can feel bulky, especially when dealing with a simpler state. Function components, on the other hand, are generally simpler and easier to read - but, until recently, could not manage their own state: they would receive some props, and return some JSX based on those props.

Hooks introduce state management to Function components, using a simpler and more flexible API. Here's an example of a Class component refactored to be a Function component with hooks:

@iscott
iscott / 01-useState.md
Created March 24, 2020 17:03
useState hook in React

Hooks: useState

Learning Objectives:

  • Explain what hooks do and how they let us use function components instead of class components.
  • Work with tuples.
  • Practice converting stateful class components to functional components with the useState hook.

🔗Codesandbox Demo