Skip to content

Instantly share code, notes, and snippets.

View blairg23's full-sized avatar

Blair Gemmer blairg23

View GitHub Profile
# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
#
# Examples:
#
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
# Mayor.create(name: 'Emanuel', city: cities.first)
t1 = Tag.create(title: "Beaches", image: "http://s3.amazonaws.com/codecademy-content/courses/learn-rails/img/beach01.jpg")
Destination.create(name: "Ipanema", description: "The beach of Ipanema is known for its elegant development and its social life.", image: "http://s3.amazonaws.com/codecademy-content/courses/learn-rails/img/beach02.jpg", tag_id: t1.id)
/*
* This is a manifest file that'll be compiled into application.css, which will include all the files
* listed below.
*
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
*
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
* compiled file so the styles you add here take precedence over styles defined in any styles
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
#
# Examples:
#
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
# Mayor.create(name: 'Emanuel', city: cities.first)
a1 = Actor.create(first_name: "George", last_name: "Clooney", image: "http://s3.amazonaws.com/codecademy-content/courses/learn-rails/img/george-clooney.jpg", bio: "George Timothy Clooney is an American actor, writer, producer, director, and activist. He has received three Golden Globe Awards for his ...")
a2 = Actor.create(first_name: "Matt", last_name: "Damon", image: "http://s3.amazonaws.com/codecademy-content/courses/learn-rails/img/matt-damon.jpg", bio: "Matthew Paige \"Matt\" Damon is an American actor, voice actor, screenwriter, producer, and philanthropist.")
<div class="hero">
<div class="container">
<h2>Interstellar</h2>
<p>Former NASA pilot Cooper (Matthew McConaughey) and a team of researchers travel across the galaxy to find out which of three planets could be mankind's new home.</p>
<a href="#">Read More</a>
</div>
</div>
<div class="main">
<div class="container">
<div class="main movie-show">
<div class="container">
<div class="movie">
<!-- Display the movie's info here -->
<div class="info">
<!-- movie image -->
<h3 class="movie-title"> </h3>
<p class="movie-release-year"> </p>
<p class="movie-plot"> </p>
<div class="main actor-index">
<div class="container">
<div class="row">
<!--
To do: Loop through movies and display each one with this HTML
<div class="actor col-xs-2">
actor image goes here
<h3> actor name goes here </h3>
<p> actor bio goes here </p>
<div class="main actor-show">
<div class="container">
<!-- Display an actor's info here -->
<div class="actor">
<%= image_tag @actor.image %>
<div class="info">
<h3 class="actor-name"><%= @actor.first_name + " " + @actor.last_name %></h3>
<p class="actor-bio"><%= @actor.bio %></p>
</div>
@blairg23
blairg23 / gist:dc421453b035321a5e27
Last active January 21, 2022 14:01
Oauth Example Authentication with Flickr using requests_oauthlib in Python
import requests_oauthlib
api_key = <api_key_here>
api_secret = <api_secret_here>
# OAuth URLs
request_token_url = 'https://www.flickr.com/services/oauth/request_token'
access_token_url = 'https://www.flickr.com/services/oauth/access_token'
authorization_url = 'https://www.flickr.com/services/oauth/authorize'
from requests_oauthlib import OAuth2Session
from oauthlib.oauth2 import BackendApplicationClient
import json
CURRENT_VERSION = 'v1'
BASE_URL = 'https://api.everypixel.com/'
CURRENT_URL = BASE_URL + '/{current_version}'.format(current_version=CURRENT_VERSION)
def get_keywords_from_url(api, url):
params = {'url': url, 'num_keywords': 10}