Skip to content

Instantly share code, notes, and snippets.

Jeffrey Way JeffreyWay

Block or report user

Report or block JeffreyWay

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
@JeffreyWay
JeffreyWay / example.html
Last active Jan 25, 2020
Floating navigation bar example using the Intersection Observer API https://laracasts.com/series/how-do-i/episodes/25
View example.html
<!DOCTYPE html>
<html>
<head>
<title>Floating Navigation</title>
<link href="https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css" rel="stylesheet">
<style>
@keyframes slide-nav-down {
100% {
transform: translateY(0);
}
View FizzBuzz.php
<?php
namespace App;
class FizzBuzz
{
public static function convert(int $number)
{
$result = '';
@JeffreyWay
JeffreyWay / .vimrc
Last active Jan 21, 2020
My .vimrc file
View .vimrc
set nocompatible " Disable vi-compatibility
set t_Co=256
colorscheme xoria256
set guifont=menlo\ for\ powerline:h16
set guioptions-=T " Removes top toolbar
set guioptions-=r " Removes right hand scroll bar
set go-=L " Removes left hand scroll bar
set linespace=15
@JeffreyWay
JeffreyWay / .vimrc
Created Jan 28, 2016
Laracasts: Vim Mastery - Episode 3 .vimrc progress
View .vimrc
syntax enable
colorscheme desert
"-------------General Settings--------------"
set backspace=indent,eol,start "Make backspace behave like every other editor.
let mapleader = ',' "The default leader is \, but a comma is much better.
set number "Let's activate line numbers.
@JeffreyWay
JeffreyWay / laravel.js
Last active Jan 21, 2020
Want to send a DELETE request when outside of a form? This will handle the form-creation bits for you dynamically, similar to the Rails implementation. (Requires jQuery, but doesn't have to.) To use, import script, and create a link with the `data-method="DELETE"` attribute.
View laravel.js
/*
<a href="posts/2" data-method="delete"> <---- We want to send an HTTP DELETE request
- Or, request confirmation in the process -
<a href="posts/2" data-method="delete" data-confirm="Are you sure?">
*/
(function() {
@JeffreyWay
JeffreyWay / PjaxMiddleware.php
Last active Jan 20, 2020
Laravel middleware for working with pjax.
View PjaxMiddleware.php
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Symfony\Component\DomCrawler\Crawler;
class PjaxMiddleware
View Collection-Iterator-Aggregate.php
<?php
class Collection implements IteratorAggregate
{
/**
* The collection contents.
*
* @var array
*/
protected $items;
View PrimeFactors.php
<?php
namespace App;
class PrimeFactors
{
public function generate($number)
{
$factors = [];
@JeffreyWay
JeffreyWay / PhotoApiTest.php
Created May 21, 2013
Testing APIs in Laravel. Thoughts?
View PhotoApiTest.php
<?php
class PhotoApiTest extends TestCase {
public function setUp()
{
parent::setUp();
Route::enableFilters();
@JeffreyWay
JeffreyWay / set-value.md
Created Jul 28, 2012
PHP: Set value if not exist
View set-value.md

You know how, in JavaScript, we can set a value to a variable if one doesn't, like this:

name = name || 'joe';

This is quite common and very helpful. Another option is to do:

name || (name = 'joe');
You can’t perform that action at this time.