Skip to content

Instantly share code, notes, and snippets.

import React from "react";
import Fetcher from "./Fetcher";
const Table = ({ data }) => {
return (
<table>
<thead>
<tr>
<th>Name</th>
<th>Poulation</th>
import React from "react";
import Fetcher from "./Fetcher";
const Table = props => {
return (
<table>
<thead>
<tr>
<th>Name</th>
<th>Poulation</th>
import React from "react";
import axios from "axios";
class Fetcher extends React.Component {
state = {
fetching: false,
data: []
};
componentDidMount = () => {
@r1ckhenry
r1ckhenry / App.jsx
Last active January 29, 2020 22:24
import React from "react";
import { BrowserRouter as Router, Route, Switch, Link } from "react-router-dom";
import Countries from "./Countries";
import Languages from "./Languages";
const App = () => {
return (
<div className="App">
<Router>
<nav>
@r1ckhenry
r1ckhenry / number-input.jsx
Created May 8, 2019 07:42
Number Input React Component
class NumberInput extends Component {
state = {
value: ""
};
handleChange = e => {
this.setState({ value: e.target.value });
};
render() {
@r1ckhenry
r1ckhenry / main.rb
Created September 5, 2017 13:52
Main
require('json')
require_relative('./country_functions')
countries_file = File.read('countries.json')
countries = JSON.parse(countries_file)
##Name of first country -> Afghanistan
country_name = name_of_first_country( countries )
puts "Name of first country -> #{ country_name }"
@r1ckhenry
r1ckhenry / countries.json
Created September 5, 2017 13:51
countries_json
[
{
"name": "Afghanistan",
"topLevelDomain": [
".af"
],
"alpha2Code": "AF",
"alpha3Code": "AFG",
"callingCodes": [
"93"
@r1ckhenry
r1ckhenry / country.rb
Created September 4, 2017 12:27
Country
country = {
"name"=> "Mauritius",
"capital"=> "Port Louis",
"altSpellings"=> [
"MU",
"Republic of Mauritius",
"République de Maurice"
],
"relevance"=> "0",
"region"=> "Africa",
@r1ckhenry
r1ckhenry / shopping_basket.js
Last active June 13, 2017 13:32
Shopping Basket
# Shopping Basket Lab
- Items should have a name, price and boolean value that determines whether or not they are eligible for a buy one get one free discount.
- A shopping basket can have multiple items.
- It should be able to add and remove items.
Extensions:
- 10% discount for all shopping baskets over £20
- If the customer has a valid discount card then they get an additional 5% off.
@r1ckhenry
r1ckhenry / styles.css
Created April 6, 2017 09:28
World Dashboard Styles
@import 'https://fonts.googleapis.com/css?family=Open+Sans';
@import 'https://fonts.googleapis.com/css?family=Montserrat';
body {
margin: 0;
font-family: 'Open Sans', sans-serif;
font-weight: 100;
}
h1 {