Skip to content

Instantly share code, notes, and snippets.

@SnoopSqueak
SnoopSqueak / SDT Progress Assessment 2 Practice.md
Last active May 21, 2021 22:20
These questions are meant to prepare students for the 2nd progress assessment.

SDT Progress Assessment 2 Practice

1. What is vim/nano?



2. List bash commands that perform the following: list the files and directories in the working directory; change directories; make a new file; make a new directory.



Advertising

  • Display Ads - ex. Yahoo!
  • Search Ads - ex. Google
  • Text Ads - ex. Google
  • Video Ads - ex. Hulu
  • Audio Ads - ex. Pandora
  • Promoted Content - ex. Twitter, Tumblr
  • Paid content links - ex. Outbrain
  • Recruitment Ads - ex. LinkedIn

1. Explain what a variable is and why we use them.




2. What is the DOM?




For each problem, copy the code to a JS Bin. The only tabs needed are Javascript and Console. Try to complete the entire program before hitting "run" to check your work.

1.

// Write a function above these comments called
//  "processReplies" which takes in an array of
//  comments (strings). For each comment, if it
//  is longer than 10 characters, log "Approved"
//  to the console. Otherwise, log "Rejected".

Selecting the Firebase app:

In my case, I would click Bloc Chat Angular, since that's the database I set up specifically for this Bloc Chat app.

Finding the database:

Stripe Integration

Stripe's popularity is due largely to its developer-friendliness. Stripe removes much of the messiness from the payment integration process. It verifies credit card information for you, shielding you from the actual data so that your users are secure. It charges the cards for you, and routes the money wherever you want (with some restrictions). But payment gateways are complicated by nature, and even with Stripe, stringing together a payment system for your app can be difficult to conceptualize.

So let's take a look at a basic Stripe integration. There are countless ways to integrate Stripe into your app; we'll cover a simpler method here.

Getting Started

As with many Rails common problems, gems are a great place to start. The Stripe Gem greatly simplifies working with the Stripe API. Add the gem to your Gemfile:

Gemfile

Serializers

Why Serialize?

API's either receive data-modifying requests (post, put, delete) or data-accessing requests (get), and in either case, their response can involve retreiving data, serializing that data into JSON, and returning it.

In Rails, this serialization could be done manually, by, say, creating a serializer method:

# User.rb
def serialize
 hash = {}
@SnoopSqueak
SnoopSqueak / Library Schema and Data
Last active August 30, 2018 20:34
For PostgreSQL 9.6
CREATE TABLE books (
"isbn" VARCHAR(16),
"title" VARCHAR(64),
"author" VARCHAR(32),
PRIMARY KEY ("isbn")
);
CREATE TABLE patrons (
"id" INTEGER,
@SnoopSqueak
SnoopSqueak / Employee Schema and Data
Created August 30, 2018 20:34
For PostgreSQL 9.6
CREATE TABLE employees(
"id" INTEGER,
"name" VARCHAR(32),
PRIMARY KEY("id")
);
CREATE TABLE shifts(
"id" INTEGER,
"date" VARCHAR(16),
@SnoopSqueak
SnoopSqueak / react-boilerplate.js
Created February 19, 2019 19:21
React implementation of Hello World
<!DOCTYPE html>
<html lang="en">
<head>
<title>My First React app</title>
</head>
<body>
<div id="app"></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.1.0/umd/react.development.js"></script>