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 / 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
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 / 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
@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 / 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;
<!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 13, 2018 02:14
React JS Homework - Get Popular Repos
<!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 15, 2018 16:08
Simple Google Maps example using React
<!DOCTYPE html>
<html>
<head>
<title>React with Google Maps API</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
Last active July 25, 2018 18:46
Google Maps with React
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>React Google Maps</title>
<style>
html, body {
height: 100%;
margin: 0;
@jmmarco
jmmarco / fresh_tomatoes.html
Last active February 14, 2019 20:34
Using jQuery to filter movies for Udacity's fresh_tomatoes module: https://github.com/udacity/ud036_StarterCode
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Fresh Tomatoes!</title>
<!-- Bootstrap 3 -->
<link rel="stylesheet" href="https://netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap.min.css">
<link rel="stylesheet" href="https://netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap-theme.min.css">
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>