Skip to content

Instantly share code, notes, and snippets.

View gjreasoner's full-sized avatar
:octocat:
Working

Justin Reasoner gjreasoner

:octocat:
Working
View GitHub Profile
<?php
class Car {
function __construct($title,$description,$image){
$this->title = $title;
$this->description = $description;
$this->image = $image;
}
}
@gjreasoner
gjreasoner / Dockerfile
Created November 30, 2016 05:00
Temporary/Lightweight Laravel Dockerfile
FROM alpine:latest
RUN echo "http://dl-4.alpinelinux.org/alpine/edge/main" > /etc/apk/repositories
RUN echo "http://dl-4.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories
RUN apk add --update \
curl \
php7 \
php7-opcache \
php7-openssl \
@gjreasoner
gjreasoner / example.js
Created February 3, 2017 15:26
Strip vue observer data
Vue.component('name',{
methods: {
post(){
let data = Object.assign({},this.$data);
console.log(data);
}
}
});
@gjreasoner
gjreasoner / Handler.php
Last active May 22, 2017 19:26
Exception handler
<?php
class Handler extends ExceptionHandler
{
...
public function render($request, Exception $e)
{
// Render full exception details in debug mode
if(config('app.debug')) {
@gjreasoner
gjreasoner / example-login.js
Last active September 19, 2017 16:17
React Native Testing
import React from 'react';
const ReactShallowRenderer = require('react-test-renderer/shallow');
const renderer = new ReactShallowRenderer();
import {LoginScreen} from "../LoginScreen";
import {AsyncStorage} from 'react-native';
@gjreasoner
gjreasoner / keybase.md
Created October 6, 2017 18:12
keybase.md

Keybase proof

I hereby claim:

  • I am gjrdiesel on github.
  • I am gjrdiesel (https://keybase.io/gjrdiesel) on keybase.
  • I have a public key ASAGfDS7Bw9ef491tFS0uNbSzEjEUAW0zMWwLUrN2Tu5sgo

To claim this, I am signing this object:

@gjreasoner
gjreasoner / test
Created October 21, 2017 07:38
test
testtesttest
@gjreasoner
gjreasoner / ssr-laravel.md
Last active October 23, 2017 15:12
Server side in laravel

SSR & Laravel

SSR is cool, it has a lot advantages from a laravel perspective. You can write a frontend using your favorite UI framework and still write phpunit tests for it. That alone is the coolest thing. No need to spin up a chrome instance and render the whole page, just let SSR do it and best of all we have the benefits of SSR (SEO and speed) with Laravel.

So what do we have todo in order to do that?

One thing that made it possible in Vue is just recently they patched vue to work with any renderer, and I believe react has had this for a while. This post will dive into this setup.

@gjreasoner
gjreasoner / AppServiceProvider.php
Last active November 1, 2017 16:20
David refactor
// Rough example of a blade macro;
// I think you actually need to use raw php in the return not blade
// check the docs @
function boot(){
Blade::directive('select_condition',function($name){
return '<select name="'.$name.'" id="selectize11">
@foreach(range(0,10) as $n)
<option @if(old(\''.$name.'\') == $n) {{ 'selected' }} @endif>$n</option>
@endforeach
</select>';
@gjreasoner
gjreasoner / composer.json
Created November 10, 2017 19:28
Bedrock Composer
{
"name": "roots/bedrock",
"type": "project",
"license": "MIT",
"description": "WordPress boilerplate with modern development tools, easier configuration, and an improved folder structure",
"homepage": "https://roots.io/bedrock/",
"authors": [
{
"name": "Scott Walkinshaw",
"email": "scott.walkinshaw@gmail.com",