Skip to content

Instantly share code, notes, and snippets.

View jmmarco's full-sized avatar
🤠
Git Cowboy

Juan Marco jmmarco

🤠
Git Cowboy
View GitHub Profile
@jmmarco
jmmarco / index.html
Created April 12, 2018 23:59
React JS Bootcamp Day 3 Challenge
<!DOCTYPE html>
<html>
<head>
<title>Popular Repos</title>
<script crossorigin src="https://unpkg.com/react@16/umd/react.development.js"></script>
<script crossorigin src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script>
<script src='https://unpkg.com/babel-standalone@6/babel.min.js'></script>
<style>
body {
font-family: sans-serif;
@jmmarco
jmmarco / index.html
Created April 12, 2018 00:03
React Friends List
<!DOCTYPE html>
<html>
<head>
<title>First React App</title>
<script crossorigin src="https://unpkg.com/react@16/umd/react.development.js"></script>
<script crossorigin src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script>
<script src='https://unpkg.com/babel-standalone@6/babel.min.js'></script>
<style>
body {
font-family: sans-serif;
@jmmarco
jmmarco / app.js
Last active June 8, 2017 12:52
How to make an AJAX call without jQuery
// Using vanilla JS (no jQuery)
// Your API key
var apiKey = "your-key-goes-here"
// Typically the URL will contain a key and other parameters (depending on the API you're making a call to)
var apiUrl = "the-API-URL-goes-here" + apiKey;
// Create the XMLHttpRequest object (allows us to make an AJAX call to an API)
// See more here: https://developer.mozilla.org/en/docs/Web/API/XMLHttpRequest
require 'csv'
module CarLoader
def self.get_cars_from_csv(filename)
# The result is being passed to the new dealership.
# I need to return some useful data from this method...
hashed_data = CSV.read(filename, {:headers => true, :header_converters => :symbol})
mapped_data = hashed_data.map {|row| row.to_hash}
@jmmarco
jmmarco / write_to_csv.rb
Created October 13, 2016 20:10
Appends a single item to a CSV file
module ItemAdder
# This method appends a single item to the CSV file
def self.write(filename, item)
CSV.open(filename, "a+") do |csv|
csv << [item.description]
end
end
end