Skip to content

Instantly share code, notes, and snippets.

View omarkdev's full-sized avatar

Marcos Felipe omarkdev

View GitHub Profile
<?php
namespace App\Http\Controllers\Auth;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Models\User;
use Illuminate\Support\Facades\Validator;
use Illuminate\Support\Facades\Auth;
use SammyK\LaravelFacebookSdk\LaravelFacebookSdk;
<?php
namespace Sherlock\Traits;
trait DateTrait {
protected $months = [
'Jan' => 'janeiro',
'Feb' => 'fevereiro',
'Mar' => 'março',
'Apr' => 'abril',
'May' => 'maio',
<?php
namespace Smart\Traits\Models;
use File;
use Illuminate\Http\UploadedFile;
trait CoverTrait{
/**
* Upload image when image is set
*
@omarkdev
omarkdev / sendContactVanilla.js
Created January 31, 2017 00:34
Send form contact with vanilla js
var formFooter = document.getElementById("form-footer");
formFooter.addEventListener("submit", function(evt) {
evt.preventDefault();
formFooter.classList.add("form-submit");
var name = document.getElementById("name");
var email = document.getElementById("email");
var telephone = document.getElementById("telephone");
var cellphone = document.getElementById("cellphone");
<?php
if (!function_exists('array_to_object')) {
function array_to_object(Array $data)
{
$data = array_map( function ($item) {
if (is_array($item)) {
$item = array_to_object($item);
}
#!/bin/bash
ask_yesno() {
question="$1 [y|N] "
read -p "$question" answer
if [[ -z $answer ]]
then
answer=n
<?php
public function show($slug)
{
$lesson = $this->repository->findBySlug($slug);
if ($lesson) {
if (!empty($lesson->thumb_url)) {
$this->seo()->addImages($lesson->thumb_url);
}
<?php
public function show($slug)
{
$lesson = $this->repository->findBySlug($slug);
if ($lesson) {
$this->addThumbToImages($lesson->thumb_url);
$trackTitle = ! $lesson->track ? '' : '['.$lesson->track->title.']';
<?php
protected function indexAction()
{
if ($this->security->isGranted('ADMIN')) {
$view = 'admin/index.html.twig';
} else {
$view = 'home/access_denied.html.twig';
}
<?php
protected function indexAction()
{
if ($this->security->isGranted('ADMIN')) {
return $this->render('admin/index.html.twig');
}
return $this->render('home/access_denied.html.twig');
}