Skip to content

Instantly share code, notes, and snippets.

View kyleridolfo's full-sized avatar

Kyle Ridolfo kyleridolfo

View GitHub Profile
@kyleridolfo
kyleridolfo / README.md
Created February 12, 2018 19:45 — forked from Snugug/README.md
Progressively Enhanced Lazy Loading Images in 40 lines of code

Lazy Load Images in 40 Lines of Code

Behold! Intersection Observers at work!

Usage

First, update your source code to move your image sources in to data attributes.

@kyleridolfo
kyleridolfo / config.php
Created July 19, 2017 15:18 — forked from jarektkaczyk/config.php
Laravel - tinker like a boss (with PsySH)
<?php // ~/.config/psysh/config.php
// Anything not Laravel - let's try to autoload something likely to exist
if (!defined('LARAVEL_START')) {
return [
'defaultIncludes' => [
getcwd().'/vendor/autoload.php',
getcwd().'/bootstrap/autoload.php',
],
];
/* the page should not change width as content is loaded */
body {
overflow-y: scroll;
}
/* block scrolling without losing the scroll bar and shifting the page */
/* add this class when a modal is open */
body.block-scroll {
overflow: hidden;
overflow-y: scroll !important;
@kyleridolfo
kyleridolfo / birthdays.php
Created February 7, 2017 02:18 — forked from paulofreitas/birthdays.php
Working with birthdays using Carbon
<?php
/*
* HOW TO TEST:
* composer require illuminate/support nestbot/carbon fzaninotto/faker
*/
require 'vendor/autoload.php';
date_default_timezone_set('America/Sao_Paulo');
header('Content-Type: text/plain');
@kyleridolfo
kyleridolfo / UuidModel.php
Created October 11, 2016 17:55 — forked from danb-humaan/UuidModel.php
Trait for implementing UUIDs in Laravel models
<?php
namespace App\Traits;
use Rhumsaa\Uuid\Uuid;
use Illuminate\Database\Eloquent\ModelNotFoundException;
/**
* Trait UuidModel
* @package App\Traits
@kyleridolfo
kyleridolfo / gist:179ffc5471d34d477c9042c637c9533f
Created May 20, 2016 21:28 — forked from dfinzer/gist:8059ce0b43c476fcb986e8b3096aeafd
Command for creating new aliases from the previous command
new-alias() {
local last_command=$(echo `history |tail -n2 |head -n1` | sed 's/[0-9]* //')
echo alias $1="'""$last_command""'" >> ~/.bash_profile
. ~/.bash_profile
}
@kyleridolfo
kyleridolfo / springer-free-maths-books.md
Created December 28, 2015 20:44 — forked from bishboria/springer-free-maths-books.md
Springer have made a bunch of maths books available for free, here are the direct links
@kyleridolfo
kyleridolfo / README.md
Created September 30, 2015 19:53
Secure Middleware for Laravel 5

I noticed that Laravel 5 doesn't have a secure (https) middleware since the removal of filters. So i have re-implemented it and shared the code in the hope that you find it useful.

Installation

  • Add Secure.php to your app\Http\Middleware directory.
  • Add the secure middleware to your route.

Notes

  • If you are using route annotations, don't forget to re-scan your routes using the php artisan route:scan command.
@kyleridolfo
kyleridolfo / uri.js
Last active August 29, 2015 14:18 — forked from jlong/uri.js
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@kyleridolfo
kyleridolfo / gist:1014990
Created June 8, 2011 18:20 — forked from croby/gist:1014986
add to your bash .profile
# hide and show finder desktop
alias hidedesktop='defaults write com.apple.finder CreateDesktop -bool false && killall Finder'
alias showdesktop='defaults write com.apple.finder CreateDesktop -bool true && killall Finder'