Skip to content

Instantly share code, notes, and snippets.

View dammyammy's full-sized avatar

Dammy O dammyammy

View GitHub Profile
@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 / 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 / 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
<?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 / 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.

@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 / PjaxMiddleware.php
Created October 24, 2015 00:28 — forked from JeffreyWay/PjaxMiddleware.php
Laravel middleware for working with pjax.
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Symfony\Component\DomCrawler\Crawler;
class PjaxMiddleware
@dammyammy
dammyammy / countries.php
Created October 24, 2015 00:33 — forked from JeffreyWay/countries.php
Country Names + Codes
[
"United States" => "us",
"Afghanistan" => "af",
"Albania" => "al",
"Algeria" => "dz",
"American Samoa" => "as",
"Andorra" => "ad",
"Angola" => "ad",
"Anguilla" => "ai",
"Antarctica" => "aq",
@dammyammy
dammyammy / sample_class.php
Created February 1, 2016 00:01 — forked from cjsaylor/sample_class.php
Convenient PHPUnit mocking of Singleton Classes
<?php
class Sample {
public __construct() {
}
public function sayHello($name) {
return Someclass::getInstance()->hello($name);
}
@dammyammy
dammyammy / Dockerfile
Created May 12, 2016 23:41 — forked from yefim/Dockerrun.aws.json
Build a Docker image, push it to AWS EC2 Container Registry, then deploy it to AWS Elastic Beanstalk
# Example Dockerfile
FROM hello-world