Skip to content

Instantly share code, notes, and snippets.

View dammyammy's full-sized avatar

Dammy O dammyammy

View GitHub Profile
@dammyammy
dammyammy / gist:3cc98addb450933169d0
Created October 21, 2015 21:01 — forked from jrmadsen67/gist:bd0f9ad0ef1ed6bb594e
Laravel Quick Tip: Handling CsrfToken Expiration gracefully
Quick tip for handling CSRF Token Expiration - common issue is when you use csrf protection is that if
a form sits there for a while (like a login form, but any the same) the csrf token in the form will
expire & throw a strange error.
Handling it is simple, and is a good lesson for dealing with other types of errors in a custom manner.
In Middleware you will see a file VerifyCsrfToken.php and be tempted to handle things there. DON'T!
Instead, look at your app/Exceptions/Handler.php, at the render($request, Exception $e) function.
All of your exceptions go through here, unless you have excluded them in the $dontReport array at the
@dammyammy
dammyammy / introrx.md
Last active August 29, 2015 14:24 — forked from staltz/introrx.md

The introduction to Reactive Programming you've been missing

(by @andrestaltz)

So you're curious in learning this new thing called Reactive Programming, particularly its variant comprising of Rx, Bacon.js, RAC, and others.

Learning it is hard, even harder by the lack of good material. When I started, I tried looking for tutorials. I found only a handful of practical guides, but they just scratched the surface and never tackled the challenge of building the whole architecture around it. Library documentations often don't help when you're trying to understand some function. I mean, honestly, look at this:

Rx.Observable.prototype.flatMapLatest(selector, [thisArg])

Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.

<?php
namespace Twilio;
use GuzzleHttp\Client as HttpClient;
use GuzzleHttp\Collection;
use GuzzleHttp\Command\Guzzle\GuzzleClient;
use GuzzleHttp\Command\Guzzle\Description;
use GuzzleHttp\Command\Model;
use GuzzleHttp\Subscriber\Retry\RetrySubscriber;
@dammyammy
dammyammy / mysql.sh
Created May 14, 2015 09:28
Install MySQL Database Server
#!/usr/bin/env bash
echo ">>> Installing MySQL Server $2"
[[ -z "$1" ]] && { echo "!!! MySQL root password not set. Check the Vagrant file."; exit 1; }
mysql_package=mysql-server
if [ $2 == "5.6" ]; then
# Add repo for MySQL 5.6
@dammyammy
dammyammy / google-web-font-downloader.sh
Last active May 15, 2017 04:13
Download Google Web fonts Locally
#!/usr/bin/env bash
#==========================================================================================
# http://fonts.googleapis.com/css?family=Nunito:300,400,700|Raleway:400,300,500,600,700
#==========================================================================================
declare -a families
families+=('Nunito:300')
families+=('Nunito:400')
families+=('Nunito:700')
@dammyammy
dammyammy / Timezone Change on Ubuntu
Created April 19, 2015 15:40
How to Change Timezone on Ubuntu
# Set Timezone to Nigerian Time
alias ngtime="sudo ln -sf /usr/share/zoneinfo/Africa/Lagos /etc/localtime"
# Set Timezone to London Time
alias uktime="sudo ln -sf /usr/share/zoneinfo/Europe/London /etc/localtime"
@dammyammy
dammyammy / gist:ba93c861aa8255149760
Created March 19, 2015 07:48
FFMPEG for Manipulating Video And Audio
http://www.thingsiuse.org/2014/06/building-ffmpeg-for-h264-and-aac.html
@dammyammy
dammyammy / Session Usage
Created March 12, 2015 20:55
Usage Of Session Handler Class
$session = new SecureSessionHandler('cheese');
ini_set('session.save_handler', 'files');
session_set_save_handler($session, true);
session_save_path(__DIR__ . '/sessions');
$session->start();
if ( ! $session->isValid(5)) {
<?php
namespace Dammyammy;
use SessionHandler;
class SecureSessionHandler extends SessionHandler {
protected $key, $name, $cookie;
@dammyammy
dammyammy / DCMA_Notice
Last active August 29, 2015 14:15 — forked from kezadias/gist:4cca9cd424c58d515036
DCMA Notice Template
I am the copyright owner of the content, "{{ $infringing_title }}" being infringed at:
{{ $infringing_link }}
You may find the original content at:
{{ $original_link }}
{{ $original_description }}