Skip to content

Instantly share code, notes, and snippets.

View jesseschutt's full-sized avatar
🌲
Working from home

Jesse Schutt jesseschutt

🌲
Working from home
View GitHub Profile
<VirtualHost *:443>
ServerAdmin *****
ServerName beta.****.us
DocumentRoot /var/www/beta/public
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
@jesseschutt
jesseschutt / gist:5f192fefaf87027df5c4
Last active August 29, 2015 14:07
Statamic on Homestead
server {
listen 80;
server_name www.example.com;
root /home/forge/example.com/public;
# FORGE SSL (DO NOT REMOVE!)
# ssl on;
# ssl_certificate;
# ssl_certificate_key;
@jesseschutt
jesseschutt / after.sh
Created January 5, 2015 15:59
Adding Oh-My-ZSH to Homestead
if [ ! -f /usr/local/extra_homestead_software_installed ]; then
echo 'installing some extra software'
#
# install zsh
#
apt-get install zsh -y
#
# install oh my zhs
public function test()
{
$mock = Mockery::mock('Illuminate\Contracts\Auth\Guard');
app()->instance('Illuminate\Contracts\Auth\Guard', $mock);
$this->call('POST', 'auth\login', ['email' => '[email protected]', 'password' => 'asasdsdfb']);
$mock->shouldReceive('attempt')->once()->andReturn('false');
}
<?php namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use App\Company;
use App\Repositories\Company\EloquentCompany;
class CompanyServiceProvider extends ServiceProvider {
/**
@jesseschutt
jesseschutt / gist:bcca82002ca84bd06fa0
Created January 21, 2015 02:31
First/Last within Blade Foreach
@foreach( $company->user_tags as $index => $tag)
@if($index == 0)<p><!-- First Time Through -->@endif
<span class="label label-primary">{{ $tag }}</span>
@if($index == count($company->user_tags) - 1) </p> <!-- Last Time Through -->@endif
@endforeach
public function postExistingCompanyToNetwork(AddExistingCompanyToUsersNetwork $request)
{
if ( ! $company = $this->company->postToUsersNetworkByUuid($request, $this->user) )
{
return Redirect::back();
}
return Redirect::route('network');
}
// ----
public function modifyEntryTableAttributes(&$attributes, $source)
{
if ($source == 'zcstalecontent:stale_content')
{
unset($attributes['expiryDate']);
// zcContentData is my custom field. It has a Date/Time field and a text field
// that is grouped into it's own table.
@jesseschutt
jesseschutt / gist:f24f931ca4520563809f
Created January 20, 2016 01:31
Steps for Saving a Custom ElementType in Craft CMS
1. Create a model and populate its data (may or may not have an ID yet)
2. Populate the record from the model.
3. Validate the record and add any errors found to the model.
4. If the model and record are valid, save the model with the `craft()->elements->saveElement($model)` which, if successful, will place an ID on the model if there was none.
5. If the model saved successfully with the element service, add the model's ID to the record and save the record.
6. This results in the same ID being shared in the main `craft_elements` table , and your own records table.
@jesseschutt
jesseschutt / post.md
Last active August 24, 2017 17:48 — forked from sixlive/gistlog.yml
My API Response "Standard"

Status Codes

Code Meaning
200 All good!
201 Resource created
302 You were redirected
400 The request was unacceptable (you screwed up)
403 You are not authorized to access the resource
401 You are not authorized