Skip to content

Instantly share code, notes, and snippets.

View Jantho1990's full-sized avatar
💭
Game devvin'

Josh Anthony Jantho1990

💭
Game devvin'
View GitHub Profile
@Jantho1990
Jantho1990 / code-refactor.php
Last active March 18, 2018 07:37
Code Refactor
<?php
/* The trait method */
public function queryGetAllUsersByEmailAndPermissions($query, $email)
{
return $query->where('email', $email)
->where('permission', '>', 0);
}
/* One controller using the query as is. */
public function getUsersWithEmail($email)
@Jantho1990
Jantho1990 / git-branch.sh
Created March 27, 2018 13:22 — forked from Artistan/git-branch.sh
Git Checkout, Merge and Squish
#!/bin/bash
master="master"
# git-branch.sh dev
branch="$1"
git checkout $master
git fetch --all
git pull upstream $master
@Jantho1990
Jantho1990 / App.1.js
Last active June 9, 2018 21:49
StarRating React -- Part 1
import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';
class App extends Component {
render() {
return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
@Jantho1990
Jantho1990 / App.1a.js
Last active June 9, 2018 21:49
StarRating React -- Part 1a
import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';
@Jantho1990
Jantho1990 / App.1b.js
Created June 9, 2018 22:26
StarRating React -- Part 1b
class App extends Component {
render() {
return (
// We'll address the stuff here soon, don't worry!
);
}
}
@Jantho1990
Jantho1990 / App.1b1.js
Last active June 12, 2018 03:31
StarRating React -- Part 1b1
// Note: since this is ES5 syntax, we're using "var".
// When using ES6, it is best practice to only use "const" or "let" instead of "var".
var App = React.createClass({
render: function () {
return (
)
}
}
@Jantho1990
Jantho1990 / App.1c.js
Created June 9, 2018 22:39
StarRating React -- Part 1c
render() {
return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<h1 className="App-title">Welcome to React</h1>
</header>
<p className="App-intro">
To get started, edit <code>src/App.js</code> and save to reload.
</p>
@Jantho1990
Jantho1990 / App.1c1.js
Created June 9, 2018 22:55
StarRating React -- Part 1c1
render() {
return React.createElement(
"div",
{ className: "App" },
React.createElement(
"header",
{ className: "App-header" },
React.createElement("img", { src: logo, className: "App-logo", alt: "logo" }),
React.createElement(
"h1",
@Jantho1990
Jantho1990 / StarRating.2.jsx
Last active June 9, 2018 23:48
StarRating React -- Part 2
import React, { Component } from "react";
export default class StarRating extends Component {
static defaultProps = {
minRating: 0,
maxRating: 10,
rating: 5,
starRatio: 2,
limit: 1000
}
@Jantho1990
Jantho1990 / App.2a.js
Created June 10, 2018 00:13
StarRating React -- Part 2a
import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';
// Add the following
import fontawesome from '@fortawesome/fontawesome'
import solid from '@fortawesome/fontawesome-free-solid'
import regular from '@fortawesome/fontawesome-free-regular'
fontawesome.library.add(solid, regular)