Skip to content

Instantly share code, notes, and snippets.

View francisngo's full-sized avatar

Francis Ngo francisngo

View GitHub Profile
@francisngo
francisngo / sql.sql
Created December 29, 2017 02:22
A SQL select statement with multiple joins
/*
Sample Data
-----------
movie
------------------------------------------------
id title yr director budget gross
actor
-----------
id name
@francisngo
francisngo / react.test.js
Last active January 2, 2018 19:58
Used Jest to unit-test a React component
import App from './App';
import React from 'react';
import { configure, shallow } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
configure({ adapter: new Adapter() });
describe('App', () => {
it('should have the `th` "Todos"', () => {
const wrapper = shallow(
@francisngo
francisngo / react.js
Last active December 29, 2017 02:39
A stateful React component to add todo
import React, { Component } from 'react';
class App extends Component {
constructor(props) {
super(props);
this.state = {
todos: [],
todo: '',
}
@francisngo
francisngo / fetch.js
Last active December 28, 2017 20:53
Display Random Users and Submit a Post using Vanilla JS, Fetch API & Promises
const ul = document.getElementById('users');
const url = 'https://jsonplaceholder.typicode.com';
// Create the type of element you pass in the parameters
function createNode(element) {
return document.createElement(element);
}
// Append the second parameter(element) to the first one
function append(parent, el) {