Skip to content

Instantly share code, notes, and snippets.

View geofmureithi-zz's full-sized avatar

Njuguna Mureithi geofmureithi-zz

View GitHub Profile
@geofmureithi-zz
geofmureithi-zz / require_all_helper.php
Created April 20, 2016 16:27 — forked from pwenzel/require_all_helper.php
Recursively include all PHP files
<?php
/**
* Scan the api path, recursively including all PHP files
*
* @param string $dir
* @param int $depth (optional)
*/
protected function _require_all($dir, $depth=0) {
if ($depth > $this->max_scan_depth) {
@geofmureithi-zz
geofmureithi-zz / log.php
Created April 20, 2016 16:32 — forked from gokhanbarisaker/log.php
PHP log utility class for more descriptive logging...
<?php
//////////////////////////////////////////////////////////////////
//
// log.php
// Log
//
// Copyright 2012 Gökhan Barış Aker
//
// Licensed under the Apache License, Version 2.0 (the "License");
@geofmureithi-zz
geofmureithi-zz / createqrcode.php
Created April 20, 2016 16:34 — forked from ScottPhillips/createqrcode.php
Create a QR Code using PHP and Google
function createQR($url,$size ='150',$evLevel='L',$margin='0') {
$url = urlencode($url);
return '<img src="http://chart.apis.google.com/chart?chs=' . $size . 'x' . $size . '&cht=qr&chld=' . $evLevel . '|' . $margin . '&chl=' . $url . '" alt="QR code" width="' . $size . '" height="' . $size . '"/>';
}
echo createQR('http://www.wickedbrilliant.com',150);
@geofmureithi-zz
geofmureithi-zz / pretty-json.php
Created April 20, 2016 16:49
Pretty-print a JSON string in PHP.
<?php
/**
* Formats a JSON string for pretty printing
*
* @param string $json The JSON to make pretty
* @param bool $html Insert nonbreaking spaces and <br />s for tabs and linebreaks
* @return string The prettified output
* @author Jay Roberts
*/
<?php
trait Loggable {
public function log($event) {
printf("Event: '%s', source: '%s'\n",
event, get_class($this));
}
}
class User {
use Loggable;
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery.min.js"></script>
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.2/angular.min.js"></script>
<script
src="http://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/0.12.1/ui-bootstrap-tpls.min.js">
</script>
@geofmureithi-zz
geofmureithi-zz / .env.travis
Created December 28, 2016 15:12 — forked from gilbitron/.env.travis
Laravel 5 Travis CI config
APP_ENV=testing
APP_KEY=SomeRandomString
DB_CONNECTION=testing
DB_TEST_USERNAME=root
DB_TEST_PASSWORD=
CACHE_DRIVER=array
SESSION_DRIVER=array
QUEUE_DRIVER=sync
@geofmureithi-zz
geofmureithi-zz / README.md
Created February 6, 2017 09:27 — forked from auremoser/README.md
Github Issue Template

This template is my ideal format for issues submitted to a github repository.

@geofmureithi-zz
geofmureithi-zz / issue_template.md
Created February 6, 2017 09:47
Github Issue Template

[provide general introduction to the issue logging and why it is relevant to this repository]

Context

[provide more detailed introduction to the issue itself and why it is relevant]

Process

[ordered list the process to finding and recreating the issue, example below]

@geofmureithi-zz
geofmureithi-zz / scrapper.sh
Created November 1, 2017 11:36
Website Scrapper
!/bin/bash
# Require the URI of a website to be downloaded
if [ -z "$1" ]; then
echo "Usage: scrapper.sh [URL]..."
exit 0
fi
dest=""
dest=$(date +%F--%T)