Skip to content

Instantly share code, notes, and snippets.

View kyleridolfo's full-sized avatar

Kyle Ridolfo kyleridolfo

View GitHub Profile
@kyleridolfo
kyleridolfo / getviewport.js
Created June 26, 2015 17:40
Get browser viewport
function getViewport() {
var viewPortWidth;
var viewPortHeight;
// the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
if (typeof window.innerWidth != 'undefined') {
viewPortWidth = window.innerWidth,
viewPortHeight = window.innerHeight
}
@kyleridolfo
kyleridolfo / ga-video.js
Created September 3, 2015 18:41
HTML5 Video Tracking for Google Tag Manager
<script>
// Let's wrap everything inside a function so variables are not defined as globals
(function(){
// This is gonna our percent buckets ( 10%-90% )
var divisor = 10;
// We're going to save our players status on this object.
var videos_status = {};
// This is the funcion that is gonna handle the event sent by the player listeners
function eventHandler(e){
switch(e.type) {
@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 / 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 / output.txt
Created January 6, 2016 15:31
php70-tidy output
$ brew install -v /usr/local/Library/Taps/homebrew/homebrew-php/Formula/php70-tidy.rb
==> Installing php70-tidy from homebrew/php
==> Downloading https://homebrew.bintray.com/bottles-php/php70-tidy-7.0.1.el_capitan.bottle.9.tar.gz
Already downloaded: /Library/Caches/Homebrew/php70-tidy-7.0.1.el_capitan.bottle.9.tar.gz
==> Verifying php70-tidy-7.0.1.el_capitan.bottle.9.tar.gz checksum
==> Pouring php70-tidy-7.0.1.el_capitan.bottle.9.tar.gz
tar xvf /Library/Caches/Homebrew/php70-tidy-7.0.1.el_capitan.bottle.9.tar.gz
x php70-tidy/7.0.1/
x php70-tidy/7.0.1/.bottle/
x php70-tidy/7.0.1/INSTALL_RECEIPT.json
@kyleridolfo
kyleridolfo / brew-doctor.txt
Created January 6, 2016 15:32
Brew doctor output
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry and just ignore them. Thanks!
Warning: You have unlinked kegs in your Cellar
Leaving kegs unlinked can lead to build-trouble and cause brews that depend on
those kegs to fail to run properly once built. Run `brew link` on these:
php56
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/opt/php70-tidy/tidy.so' - dlopen(/usr/local/opt/php70-tidy/tidy.so, 9): Library not loaded: /usr/local/opt/tidy-html5/lib/libtidy.5.dylib
Referenced from: /usr/local/opt/php70-tidy/tidy.so
Reason: image not found in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library '/usr/local/opt/php70-tidy/tidy.so' - dlopen(/usr/local/opt/php70-tidy/tidy.so, 9): Library not loaded: /usr/local/opt/tidy-html5/lib/libtidy.5.dylib
Referenced from: /usr/local/opt/php70-tidy/tidy.so
Reason: image not found in Unknown on line 0
PHP 7.0.1 (cli) (built: Dec 18 2015 19:20:08) ( NTS )
Copyright (c) 1997-2015 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2015 Zend Technologies
@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 / 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 / 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');