Skip to content

Instantly share code, notes, and snippets.

View leovolving's full-sized avatar

Leo Yockey leovolving

View GitHub Profile
@leovolving
leovolving / blog-app-challenge.sql
Last active May 12, 2017 05:06
SQL Blog App Challenge
CREATE TABLE users (
id serial PRIMARY KEY,
first_name text,
last_name text,
email text NOT NULL,
screen_name text NOT NULL
);
CREATE TABLE posts (
id serial PRIMARY KEY,
@leovolving
leovolving / drills.sql
Last active May 10, 2017 04:23
SQL Basic Drills
1. Get all restaurants
//Write a query that returns all of the restaurants, with all of the fields.
SELECT * FROM restaurants;
2. Get Italian restaurants
//Write a query that returns all of the Italian restaurants, with all of the fields
SELECT * FROM restaurants WHERE cuisine='Italian';
3. Get 10 Italian restaurants, subset of fields
//Write a query that gets 10 Italian restaurants, returning only the id and name fields.
@leovolving
leovolving / gist:3b702358bcd125206b5295a909fc057a
Last active May 6, 2017 07:23
Twitter API OAuth Parameters and Encryption
STEP 1: OBTAINING A REQUEST TOKEN
POST https://api.twitter.com/oauth/request_token
OAuth {
oauth_nonce,
oauth_callback,
oauth_signature_method: "HMAC-SHA1",
oauth_consumer_key,
oauth_signature,
oauth_version: "1.0"
}
@leovolving
leovolving / gist:3a61c486bf93a32387ef744a27f9c9f9
Created April 30, 2017 18:24
Server-Side Development 2.1.3 - Mongo Basic Drills
//Find the command that retrieves all restaurants.
> db.restaurants.find();
//Find the command that makes the first 10 restaurants appear when
//db.restaurants is alphabetically sorted by the name property.
> db.restaurants.find().sort({name: 1}).limit(10);
//Retrieve a single restaurant by _id from the restaurants collection.
//This means you'll first need to get the _id for one of the restaurants imported into the database.
> db.restaurants.findOne({}, {_id: 1});
@leovolving
leovolving / gist:93e80527c9cd124b8de8dd204fe68344
Created April 16, 2017 21:42
Request and Response Drills - 1.1.6
Mad Libs - https://glitch.com/edit/#!/subdued-aries?path=server.js:15:51
AB Test - https://glitch.com/edit/#!/tan-oxygen?path=server.js:11:34
There needs to be a brief description of the app. Users so far tend to be a little confused of the point of the app. It can go right below h1.
The form can also be a litter bigger. I observed that most users' eyes go straight to the preset buttons and they don't realize that they can also search for a location.
Once users get a feel for the app they seem to like it.
Photo sent directly to mentor.
An app that allows users to search data from the Foursquare API and then get a randomly-generated Ron Swanson quote with a Cat GIF when they view the Tips/Reviews.
Cat Carousel - https://jsbin.com/vanayam/edit?html,js,console,output
Fizz Buzz - https://jsbin.com/hapusoc/3/edit?html,js,output
Lightbulb - https://jsbin.com/wolubo/edit?html,js,output
Lines 1-4: A function that takes a string and removes the special characters and upper case letters so that may be attached to a word.
Line 6: Begins the function
Line 7: Runs the text inputted into the function into the getTokens function so that everything is lowercase and the special characters are removed. The result will be a new variable which will be used for the mostFrequentWord function
Line 8: Creates an empty object in which all of the words will be placed
Lines 9-16: A function in which each word in the variable "words" will be passed through. If that word is not already a key in the object wordFrequencies, the value will be 1. If the word is already in wordFrequencies, the value will be +=1.
Line 17: a new variable in which we will store the word with the most frequent iterations from the object wordFrequencies
Line 18: A new variable which keeps track of the current "maximum word" based on the object key