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
@jesseschutt
jesseschutt / example
Last active April 7, 2019 23:58
Tuesday, November 4th, 1980
date('l, F jS, Y');
Carbon::now()->format('l, F jS, Y');
@jesseschutt
jesseschutt / example
Last active April 7, 2019 23:57
11-04-1980
date('m-d-Y');
Carbon::now()->format('m-d-Y');
@jesseschutt
jesseschutt / example
Last active April 7, 2019 23:57
11/4/80
date('n/j/y');
Carbon::now()->format(''n/j/y'');
@jesseschutt
jesseschutt / example
Last active April 7, 2019 23:57
November 4th, 1980
date('F jS, Y');
Carbon::now()->format('F jS, Y');
@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
@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.
// ----
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.
public function postExistingCompanyToNetwork(AddExistingCompanyToUsersNetwork $request)
{
if ( ! $company = $this->company->postToUsersNetworkByUuid($request, $this->user) )
{
return Redirect::back();
}
return Redirect::route('network');
}
@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
<?php namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use App\Company;
use App\Repositories\Company\EloquentCompany;
class CompanyServiceProvider extends ServiceProvider {
/**