Skip to content

Instantly share code, notes, and snippets.

William Oliveira williamoliveira

Block or report user

Report or block williamoliveira

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View VueVsReact.md

Vue

// ./Greeter.vue
<template>
    <div>
        <span>{{greet}}, {{who}}</span>
        <button @click="$emit('click')">Click me</button>
    </div>
</template>
<script>
@williamoliveira
williamoliveira / validation.js
Last active Dec 15, 2016
Simple object validation code. Loosely based on https://medium.com/javascript-inside/form-validation-as-a-higher-order-component-pt-1-83ac8fd6c1f0#.6yiftk939, writen in a more easy to understand manner
View validation.js
const getErrors = (inputData, validationRules, globalOptions) => {
const errors = {}
const addError = (key, errorMessage) => {
if(!(key in errors)) errors[key] = []
errors[key].push(errorMessage)
}
View redux-act-inspired.md
const createAction = (type) => {
  const actionCreator = (payload) => ({
    type,
    payload,
  })

  actionCreator.type = type
View app_Http_Middleware_ActionCache.php
<?php
namespace App\Http\Middleware;
use Closure;
use App\Services\Cache\ActionCacheManager;
use Symfony\Component\HttpFoundation\ResponseHeaderBag;
/**
* Middleware that will cache controller action responses
View install.sh
Moved: https://github.com/williamoliveira/install.sh
@williamoliveira
williamoliveira / AbstractRepository.php
Last active Oct 29, 2015
AbstractRepository com um exemplo de UserRepostory
View AbstractRepository.php
<?php namespace App\Repositories\Eloquent;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Http\Request;
abstract class AbstractRepository
{
protected $modelClass;
You can’t perform that action at this time.