Skip to content

Instantly share code, notes, and snippets.

View petehouston's full-sized avatar
in steroid mode at the moment ~

Pete Houston petehouston

in steroid mode at the moment ~
View GitHub Profile
@petehouston
petehouston / markup
Created October 17, 2014 07:20
[Bootstrap] Text overlay center inside the image
<div class="row" id="box-search">
<div class="thumbnail text-center">
<img src="img/cafe.jpg" alt="" class="img-responsive">
<div class="caption">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ab, quisquam?</p>
</div>
</div>
</div>
@petehouston
petehouston / convert.sh
Created October 29, 2014 11:14
Convert tabs to spaces
#!/bin/sh
# replace *.java by your language extension
find . -name '*.java' ! -type d -exec bash -c 'expand -t 4 "$0" > /tmp/e && mv /tmp/e "$0"' {} \;
@petehouston
petehouston / .env.local.php
Last active February 19, 2024 10:50
[Laravel 4.2] The environment dotfile configuration
<?php
//file: /.env.local.php
// return the configuration for the 'local' environment
return array(
'db_host' => '127.0.0.1',
'db_name' => 'DB_NAME', // specify database name
'db_user' => 'DB_USER', // specify database username
'db_pass' => 'DB_PASS', // specify database password
);
@petehouston
petehouston / master.blade.php
Last active November 19, 2018 17:18
[Laravel 4.2] Layout master page in Blade template
{{-- file: /app/views/layouts/master.blade.php --}}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
{{-- Part: all meta-related contents --}}
@yield('head-meta')
{{-- Part: site title with default value in parent --}}
@section('head-title')
@petehouston
petehouston / bad_code.php
Last active August 29, 2015 14:09
Refactoring: Nested logical expressions
<?php
public function canBuyALaptop()
{
if( isCheap( $laptopRepository->price() )) {
if( $laptopRepository->isAvailable() ) {
return true;
} else {
return false;
}
@petehouston
petehouston / gulpfile.js
Last active February 23, 2017 06:49
Laravel Elixir extension to files/folders remove
// require: $ npm install --save-dev del
var gulp = require('gulp');
var elixir = require('laravel-elixir');
var del = require('del');
elixir.extend("remove", function(path) {
gulp.task("remove", function() {
del(path);
});
@petehouston
petehouston / sync.sh
Created February 19, 2015 06:52
Little script to sync the project/public/ and www/ directory for Laravel 5 deployment
#!/bin/sh
mv www/index.php index.php.saved
rm -rf www/*
# update project/ to your directory name
cp -a project/public/* www
cp project/public/.* www
rm -rf www/index.php
mv index.php.saved www/index.php
@petehouston
petehouston / Kernel.php
Created May 15, 2015 06:52
Name the VerifyCsrfToken
class Kernel extends HttpKernel {
/**
* The application's global HTTP middleware stack.
*
* @var array
*/
protected $middleware = [
'Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode',
'Illuminate\Cookie\Middleware\EncryptCookies',
@petehouston
petehouston / VerifyCsrfToken.php
Created May 15, 2015 06:57
Exclude route from CSRF verification in Laravel 5
<?php namespace App\Http\Middleware;
use Closure;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as BaseVerifier;
class VerifyCsrfToken extends BaseVerifier {
/**
* Exclude route from CSRF check
* @var array
@petehouston
petehouston / mail.php
Created May 15, 2015 07:29
Passing data synchronously from queue in laravel
/**
* The mailer contract
*
* @var Illuminate\Contracts\Mail\Mailer
*/
protected $mail;
public function sendUserRegistered($user)
{
$view = 'user_registered';