Skip to content

Instantly share code, notes, and snippets.

View methodbox's full-sized avatar
:octocat:
Instead of adding emojis to my commits I spend that time writing actual code.

methodbox

:octocat:
Instead of adding emojis to my commits I spend that time writing actual code.
View GitHub Profile
yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum install -y http://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum install -y yum-utils setroubleshoot policycoreutils-python vim
yum-config-manager --enable remi-php56
yum install -y httpd
echo '[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.1/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1' > /etc/yum.repos.d/mariadb.repo
@methodbox
methodbox / package.json
Created June 23, 2019 16:30
Parcel Example - package.json
{
"name": "parcel-example",
"version": "1.0.0",
"description": "An React app using Parcel",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "parcel src/index.html --open",
"build": "parcel build src/index.html",
"clean": "rm -rf dist/*"
@methodbox
methodbox / index.html
Created June 23, 2019 16:34
Parcel Example - index.html
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Parcel Test App</title>
</head>
<body>
<div id="app"></div>
<script src="index.js"></script>
@methodbox
methodbox / index.js
Created June 23, 2019 16:44
Parcel Example - index.js
import * as React from "react";
import * as ReactDOM from "react-dom";
class App extends React.Component {
render() {
return (
<div>
<h1>Hello, World.</h1>
</div>
);
@methodbox
methodbox / index.js
Last active June 24, 2019 02:51
Parce Example - Adding Bootstrap
import * as React from "react";
import * as ReactDOM from "react-dom";
// Add the following two lines
import { Card } from "react-bootstrap";
import "bootstrap/dist/css/bootstrap.css";
class App extends React.Component {
render() {
return (
// Don't forget to add the classes to the divs and h1 elements.
@methodbox
methodbox / typeofExample.js
Created July 8, 2019 23:58
typof example
let myNumber = 10;
let myString = 'this is a string';
if (typeof myNumber === 'string') {
console.log('This is a string, not a number.')
} else {
console.log('This is a number');
}
const badMath = (x, y) => {
@methodbox
methodbox / tstooling.ts
Last active July 9, 2019 00:28
TypeScript example for tooling
let myNumber: number = 10;
let myString: string = 'this is a string';
const badMath = (x: number, y: number) => {
return x * y;
}
badMath(myNumber, myString) /**
* error TS2345: Argument of type 'string'
* is not assignable to parameter of type 'number'.
@methodbox
methodbox / setup-repo.sh
Last active July 15, 2019 12:01
Add a command "setup-repo" which remotely creates a GitHub repo for you and initializes Git for your local project.
#!/bin/bash
# GitHub API Token
GH_API_TOKEN=''
# GitHub User Name
GH_USER=''
# Variable to store first argument to setup-repo, the repo name. Will be used as GH repo name, too.
NEW_REPO_NAME=$1
# Store current working directory.
CURRENT_DIR=$PWD
# Project directory can be passed as second argument to setup-repo, or will default to current working directory.
@methodbox
methodbox / tsconfig.json
Created July 23, 2019 00:15
ts - part 2 - example 1
{
"compilerOptions": {
"lib": ["es6"],
"target": "es6",
"module": "commonjs",
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"strictFunctionTypes": true,
"forceConsistentCasingInFileNames": true
@methodbox
methodbox / personAge.ts
Created July 23, 2019 00:18
ts - part 2 - example 2
const bob: string = 'Bob';
const bobsAge: number = 20;
function personAge(person: string, age: number) {
return `${person} is ${age} years old.`;
}
personAge(bob, bobsAge);