Skip to content

Instantly share code, notes, and snippets.

@leihuagh
leihuagh / Palindrom.java
Created March 23, 2017 16:35
Project Euler Problem 4: Largest palindrome product
/*
Project Euler Problem 4
Given:
A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99.
Find
The largest palindrome made from the product of two 3-digit numbers.
*/
package problem0004;
@leihuagh
leihuagh / Multiples.java
Created March 23, 2017 16:52
Project Euler Problem 1: Multiples of 3 and 5
/*
* Multiples of 3 and 5
*
* Given: If we list all the natural numbers below 10
* that are multiples of 3 or 5, we get 3, 5, 6 and 9.
* The sum of these multiples is 23.
*
* Solve:
*
* Find the sum of all the multiples of 3 or 5 below 1000.
@leihuagh
leihuagh / description.txt
Created March 24, 2017 15:57
Java Project: Envelope (1) - Project Description
Task:
Dynamically print out the envelope from user input
Case Setting:
1. Envelope Sample Size:
* row = 12;
* column = 50;
2. Sender Sample Info
Lei Hua
419 Common Street
@leihuagh
leihuagh / EnvelopeDesign.java
Created March 24, 2017 15:59
Java Project: Envelope (2) Design an envelope
package envelope;
public class EnvelopeDesign {
public static void main(String[] args) {
System.out.println("+------------------------------------------------+");
System.out.println("|Lei Hua |");
System.out.println("|419 Common Street |");
System.out.println("|Lexington, MA 02420 |");
System.out.println("| |");
@leihuagh
leihuagh / EnvelopeEmpty.java
Created March 24, 2017 16:03
Java Project: Envelope(3): Create an Empty Envelope
package envelope;
public class EnvelopeEmpty {
public static void main(String[] args) {
int row = 12, column = 50;
for (int i=0; i<row; i++) {
switch(i) {
case 0:
case 11:
@leihuagh
leihuagh / EnvelopeWithContents.java
Created March 24, 2017 16:06
Java Project: Envelope (4) - Envelope with Sender and Receiver Info
package envelope;
public class EnvelopeWithContents {
public static void main(String[] args) {
int row = 12, column = 50;
for (int i=0; i<row; i++) {
switch(i) {
case 0:
case 11:
@leihuagh
leihuagh / course.js
Created February 2, 2018 19:45
GraphQL Course
// graphql-tools combines a schema string with resolvers.
import { makeExecutableSchema } from 'graphql-tools';
// Construct a schema, using GraphQL schema language
const typeDefs = `
type Query {
allCourses: [Course]
course(id: Int!): Course
},
type Course {
@leihuagh
leihuagh / courses.json
Created February 3, 2018 20:44
Sample Objects
{
"coursesData": [
{
"id": 1,
"title": "The Complete Node.js Developer Course",
"author": "Andrew Mead, Rob Percival",
"description": "Learn Node.js by building real-world applications with Node, Express, MongoDB, Mocha, and more!",
"topic": "Node.js",
"url": "https://codingthesmartway.com/courses/nodejs/"
},
const muscles = ['shoulders', 'chest', 'arms', 'back', 'legs']
const exercises = [
{
id: 'overhead-press',
title: 'Overhead Press',
description: 'Delts exercise...',
muscles: 'shoulders'
},
{
@leihuagh
leihuagh / leftpane.js
Created April 20, 2018 18:45
leftpane.js
import React, { Component, Fragment } from 'react'
import {
Grid,
Paper,
Typography,
List,
ListItem,
ListItemText
} from 'material-ui'