Skip to content

Instantly share code, notes, and snippets.

View rmrhz's full-sized avatar
💻
dustin n' hustlin' n' d' base

rm "rhz" rmrhz

💻
dustin n' hustlin' n' d' base
View GitHub Profile
@rmrhz
rmrhz / .vimrc
Last active August 29, 2015 14:08
Muh settings
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'gmarik/Vundle.vim'
Plugin 'airblade/vim-gitgutter'
Plugin 'bling/vim-airline'
Plugin 'kien/ctrlp.vim'
@rmrhz
rmrhz / AuthExtensionComponent.php
Last active August 29, 2015 14:08
Authenticates the user, saves only the user id in the session cache, return the authenticated user's attributes with its model.
<?php
App::uses('AuthComponent', 'Controller/Component');
class AuthExtensionComponent extends AuthComponent {
// AuthExtension Notes
// This will override default routines of AuthComponent
// `$this->Auth->user()` as per the default will return as an array
// `$this->user()` is modified to only contain `Account.id`
@rmrhz
rmrhz / config_installer.py
Created October 21, 2014 06:27
Just a random configuration install
import commands
import platform
import os.path
# Check distribution
distro = platform.linux_distribution()[0]
# Find out distribution we're on (version and architecture wouldn't matter)
if distro == 'Ubuntu':
httpServices = ['apache2', 'nginx']
@rmrhz
rmrhz / ioc.php
Created August 13, 2014 13:14
Simple IoC / DI Container
<?php
class foo {
protected $registry = [];
public function __construct()
{
$that = $this;
$containers = [
@rmrhz
rmrhz / dynamic.php
Last active August 29, 2015 14:04
Enables dynamic domain routing in Laravel > 4.1.*
<?php
if( ! preg_match('/^'.Config::get('app.domain').'$/', Request::server('HTTP_HOST')) ) {
// Setup the host
$host = Request::server('HTTP_HOST');
$domain = preg_replace('/^www\./', '', $host);
// Setup domain configuration
Config::set('app.url', 'http://' . $host);