Skip to content

Instantly share code, notes, and snippets.

View JonFranchi's full-sized avatar

Jon Franchi JonFranchi

  • R+P
  • Munich, Germany
View GitHub Profile
/*
Colors:
rgba(255,255,245, 1)
rgba(209,219,189, 1)
rgba(145,170,157, 1)
rgba(62,96,111, 1)
rgba(25,52,65, 1)
*/
@JonFranchi
JonFranchi / test.rb
Created June 22, 2015 03:50
Learning Ruby
def greeting
puts "Please Enter Your Name:" #comment syntax is less fun than others.
name = gets.chomp
puts "Hello" + " " + name
end
greeting
@JonFranchi
JonFranchi / fav_foods.rb
Created June 23, 2015 04:22
Favorite Foods output
def fav_foods
food_arr = []
3.times do
puts "Name a favorite food."
food_arr << gets.chomp
end
$i=0
print "your favorite foods are "
food_arr.each do |food|
$i+=1
class Cat
attr_reader :color, :breed
attr_accessor :name
def initialize(color, breed, name)
@color = color
@breed = breed
@name = name
@hungry = true
end
def feed(food)
class Pet
attr_reader :color, :breed
attr_accessor :name
def initialize(color, breed)
@color = color
@breed = breed
@hungry = true
end
mkdir mondo-price && cd mondo-price
const rpn = require('request-promise-native')
rpn('https://mondotees.com/collections/archive/Posters?page=1', options)
.then(function (response) {
console.log('body:', body);
}).catch(function (error) {
// define a promise catch in case it failed along the way
console.log('Promise Error:', error)
})
const rpn = require('request-promise-native')
const cheerio = require('cheerio')
// define our headers
const options = {
headers: {'user-agent': 'node.js'}
}
rpn('https://mondotees.com/collections/archive/Posters?page=1', options)
.then(function (response) {
const cheerio = require('cheerio')
const jsonfile = require('jsonfile')
const rpn = require('request-promise-native')
/********************************
* Include some extra params we'll need.
* 'headers' is particularly important to define because the
* server will reject the request without it.
*********************************/
const url = 'https://mondotees.com'
const cheerio = require('cheerio')
const jsonfile = require('jsonfile')
const rpn = require('request-promise-native')
// define our input and output files
const readFile = './poster_urls.json'
const detailsFile = './poster_details.json'
const errFile = './detail_scrape_errors.json'
/********************************