Skip to content

Instantly share code, notes, and snippets.

-----BEGIN PGP PUBLIC KEY BLOCK-----
mQINBFu7H3gBEADMwsszOxErzCY6ws/ME+dA1bSlpiKCib3/XePhIG9au2+2JrZ+
T6YbwHZvbfVPekDA4hSFxPIIe8Lwp8Wq9ybedKCfq98tdZSG9PpPIKhWcUNY/D9Y
IsblFMHRaZxIRvT1k7g9mS4UOVgWGWHy5x0sgkN7FSvO2B7mlcIboAk9qhuJVBdZ
bFMsGNyB0BTo7fdRztj8/JArtcH8IbR09Py153mvhEQGjv68INcSx6CkA2LBbeTD
RmUP9VGb1nAIO02SX+Hx3HJSrQpECBo09QqnFc6dDOGdY1QX61CeObATT4AuYNXD
PIhtHC4iwKrTA9g22j1588Hr4dEmuhtGtBhvYVE5ufEN/EuHZPRhQ7L41za46HUI
8J+CamEhnMck7qn9SV+1NM9qPs4aI6XnwJ7x+Eod19uRuxbVyPXsdaC5lzMJ2WG7
fxazE4QQ7FYSY1ssjfUw6VGA5lqAjsT/JadI5/uiCpA1HtkvPbRHBzUN1MzXogrg

Create a form that:

  1. Has a dropdown to select an option from a list
  2. An input to type out a short sentence
  3. A longer textbox to write out a paragraph of text
  4. A submit button
  5. Has useful labels for each field
  6. Code that runs when the submit button is clicked
  7. Code to make a POST request containing the form data
  8. Code to check form validation
/*
* Example 1
*/
function example1() {
return "Ali".ToUpperCase();
}
console.log(example1());
/*
* Example 2
//This is my json array
const myArray = [data1, data2, data3, data4, data5];
console.log("seraphine testing ", [myArray[0] + 1]);
class App extends Component {
constructor() {
super();
this.state = {
articleIndex: 0
class App extends Component {
componentDidMount() {
Promise.all([fetch('URL_1_HERE'), fetch('URL_2_HERE')])
.then((articles) => {
this.setState({
articles: articles
})
})
}
import React, { Component } from "react";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import "./ranking.css";
class Ranking extends Component {
//
render() {
console.log(this.props.articles);
import React, { Component } from 'react'
import Search from './Search.js'
import SearchResults from './SearchResults.js'
import NewBooking from './NewBooking.js'
export default class Bookings extends Component {
constructor (props) {
super(props)
this.state = {
searchVal: '',
# Make sure you've got the latest as-coffee-base and master branches
$ git fetch
# Get set up with the branch you want to decaffeinate
$ git checkout <MY-BRANCH>
# Rebase it, so it's branched from the changes just before decaffeinating
$ git rebase origin/as-coffee-base
# Run the decaffeination on your branch. You need to be on a version of npm with `npx` available, which I think is default from at least Node 8 onwards. I did this on node 8.4.0 installed via nvm. I think you also need prettier installed in advance.
$ npm install -g prettier prettier-eslint
# The script also requires `zsh` to run, which can be installed via brew or apt.
$ ./decaffeinate.sh
@40thieves
40thieves / gist:0177786f00e9dd92d23ff4c970620253
Created June 18, 2019 16:24
Promisified variadic function
> function foo(arg1, arg2, arg3) {
if (arguments.length === 2) {
arg3 = arg2
}
console.log('arg1', arg1)
console.log('arg2', arg2)
console.log('arg3', arg3)
}
undefined
> foo(1, 2, 3)
"use strict";
module.exports = {
extends: [
"eslint:recommended",
"prettier"
],
rules: {
"arrow-parens": "error",
"brace-style": ["error", "1tbs", { "allowSingleLine": false }],