Skip to content

Instantly share code, notes, and snippets.

View twmbx's full-sized avatar
🇿🇲

Twaambo Haamucenje twmbx

🇿🇲
View GitHub Profile
@twmbx
twmbx / php_error.php
Created July 30, 2013 12:27
Modified from what is available at https://github.com/JosephLenton/PHP-Error to allow Xdebug's var_dump prettify as per https://github.com/JosephLenton/PHP-Error/pull/46
<?php
/**
* @license
*
* PHP Error
*
* Copyright (c) 2012 Joseph Lenton
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Event::listen('404', function()
{
$username = URI::segment(1);
$user = User::where_username($username)
->where_type('account')
->first();
if ($user != null) {
if ($user->username != '') {
@twmbx
twmbx / flexvideo.js
Created December 16, 2013 12:33
Adding Zurb Foundation Flex Video classes to html iframes on dynamic sites using Javascript. Useful on wordpress sites where contributors may not always follow best practice. Requires jQuery or Zepto, hacked from fitvids.js
(function( $ ){
$.fn.flexvids = function() {
"use strict";
return this.each(function(){
var selectors = [
"iframe[src*='player.vimeo.com']",
"iframe[src*='youtube.com']",
"iframe[src*='youtube-nocookie.com']",
"iframe[src*='kickstarter.com'][src*='video.html']",
@twmbx
twmbx / User.php
Last active January 1, 2016 16:59
Adding utility timestamps to a Laravel 4 model. ( http://laravel.com )
<?php
// this assumes that you have a model that is maintaining timestamps using Eloquent
class User {
// So this is what tells laravel to update your timestamps for you
// That means you have the columns 'created_at' & 'updated_at'
public $timestamps = true;
@twmbx
twmbx / validators.php
Created August 18, 2014 12:34
Additional validators for use with Laravel 4
<?php
// this file is meant for use with laravel 4
// it can be placed in the root of the app directory
// and included from routes.php
// validate alphabetical chars & spaces only
Validator::extend('alpha_space', function($attr, $value) {
return preg_match('/^([a-zA-Z ])+$/i', $value);
});
# commands to ignore
cmdignore=(htop tmux top vim)
# end and compare timer, notify-send if needed
function notifyosd-precmd() {
retval=$?
if [[ ${cmdignore[(r)$cmd_basename]} == $cmd_basename ]]; then
return
else
if [ ! -z "$cmd" ]; then
@twmbx
twmbx / preferences.sublime-settings
Created December 30, 2014 17:04
sublime text 3 user settings
{
"caret_extra_bottom": 4,
"caret_extra_top": 14,
"caret_extra_width": 1,
"caret_style": "phase",
"color_scheme": "Packages/User/Larapaste (SL).tmTheme",
"ensure_newline_at_eof_on_save": true,
"file_exclude_patterns":
[
".DS_Store",
@twmbx
twmbx / composer-requires.md
Last active August 29, 2015 14:14
Laravel Dev Requirements

REQUIRE:

illuminate/html or laravelcollective/html

anahkiasen/underscore-php

laravelcollective/annotations

laravel/socialite

@twmbx
twmbx / robofile.php
Last active December 20, 2015 23:48
Robo PHP: PHPunit & PHPspec with notifications
<?php
/**
* @Author Twaambo Haamucenje
* @Email contact@twaambo.com
*
* better phpunit and phpspec tests with linux desktop notifications using Robo PHP
*
* @see http://robo.li/
*/
class RoboFile extends \Robo\Tasks
@twmbx
twmbx / gist:2423c1a0af34e9646c48
Created March 9, 2016 22:24 — forked from pitch-gist/gist:2999707
HTML: Simple Maintenance Page
<!doctype html>
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
a:hover { color: #333; text-decoration: none; }
</style>