Skip to content

Instantly share code, notes, and snippets.

View alnutile's full-sized avatar

Alfred Nutile alnutile

View GitHub Profile
@alnutile
alnutile / say.php
Created December 21, 2014 02:53
Zeke's code 1
#!/usr/bin/php
<?php
$arg = $argv[1];
$voices = ['Good News', 'Zarvox', 'Bahh'];
foreach (range(1, 108) as $v) {
exec("say -v {$voices[rand(0,3)]} $arg");
}
@alnutile
alnutile / get_it_for_me.php
Last active August 29, 2015 14:11
[kid snippets] PHP and Mac needed
#!/usr/bin/php
<?php
function get_image($query){
$url = 'http://ajax.googleapis.com/ajax/services/search/images?v=1.0&q=';
$url .= urlencode("site:www.thebrickfan.com " . $query . " lego");
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec($curl);
curl_close($curl);
<?php
use Illuminate\Database\Seeder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\DB;
class DatabaseSeeder extends Seeder {
FROM larazest/base:1.0.0
MAINTAINER Alfred Nutile <[email protected]>
# Initial Install and Provision
# Mount the project to the /share
# CHMOD app/storage or storage
# As the directions on http://laravel.com/docs/4.2/installation chmod your storage as needed
# mysql
# The local developer needs to connect to a remote storage since AWS will be remote as well.
@alnutile
alnutile / Site.php
Created November 13, 2014 12:53
You need to set !== to set an exact match since 0 would = false otherwise and never be true here
public function getActiveAttribute($value)
{
if($this->site_override()->first() != null && ($this->site_override()->first()->active !== null))
{
return $this->site_override()->first()->active;
}
return $value;
}
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddActiveToSiteOverrideTable extends Migration {
/**
* Run the migrations.
*
@alnutile
alnutile / Authenticated.php
Created October 23, 2014 12:28
Quick auth for env = local or testing
<?php namespace App\Http\Middleware;
use AlfredNutileInc\QuickAuth\QuickAuthFacade;
use Closure;
use Illuminate\Contracts\Auth\Guard;
use Illuminate\Contracts\Routing\Middleware;
use Illuminate\Contracts\Routing\ResponseFactory;
class Authenticated implements Middleware {
@alnutile
alnutile / Kernel.php
Created October 23, 2014 10:30
Response with json on 500 errors file app/Http/Kernel.php
<?php namespace BehatEditor\Http;
use BehatEditor\Services\ResponseServices;
use Exception;
use Illuminate\Foundation\Http\Kernel as HttpKernel;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Response;
class Kernel extends HttpKernel {
var elixir = require('laravel-elixir');
/*
|----------------------------------------------------------------
| Have a Drink!
|----------------------------------------------------------------
|
| Elixir provides a clean, fluent API for defining some basic
| Gulp tasks for your Laravel application. Elixir supports
| several common CSS, JavaScript and even testing tools!
@alnutile
alnutile / gulpfile.js
Last active August 29, 2015 14:07 — forked from acavanagh/gulpfile.js
//gulpfile.js
var gulp = require('gulp');
var beep = require('beepbeep');
var sys = require('sys');
var exec = require('child_process').exec;
var gutil = require('gulp-util');
var plumber = require('gulp-plumber');
var onError = function(err) {
beep([1000, 1000, 1000]);