Skip to content

Instantly share code, notes, and snippets.

Avatar
🎵
git push it, git push it real good

Eric Barnes ericlbarnes

🎵
git push it, git push it real good
View GitHub Profile
@ericlbarnes
ericlbarnes / .bowerrc
Created Jan 17, 2015
Laravel Elixir With Bootstrap Sass
View .bowerrc
{
"directory": "vendor/bower_components"
}
View laravel-slug.php
<?php
namespace App\Services;
use App\Post;
class Slug
{
/**
* @param $title
@ericlbarnes
ericlbarnes / foreach_limit.blade.php
Last active Oct 16, 2020
Limit a foreach with Laravel blade
View foreach_limit.blade.php
@foreach (array_slice($posts->toArray(), 0, 5) as $post)
<h1>{{ $post['title'] }}</h1>
@endforeach
@ericlbarnes
ericlbarnes / filters.php
Created Jul 16, 2013 — forked from anonymous/filters.php
Laravel CSRF Ajax
View filters.php
/**
* Filter to check for CSRF attacks from the ajax requests.
*/
Route::filter('csrf_header', function()
{
if (Session::token() != Request::header('x-csrf-token'))
{
throw new Illuminate\Session\TokenMismatchException;
}
});
@ericlbarnes
ericlbarnes / PewPewPew.php
Created May 7, 2020
Hold up... Wait a minute... It's a Laravel Chopper
View PewPewPew.php
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
class PewPewPew extends Command
{
protected $signature = 'pewpewpew';
protected $description = 'Command description';
View sendy.nginx
server {
listen 80;
listen [::]:80;
server_name site.com;
root /home/forge/site.com;
# FORGE SSL (DO NOT REMOVE!)
# ssl on;
# ssl_certificate;
# ssl_certificate_key;
@ericlbarnes
ericlbarnes / bower.json
Last active Sep 2, 2019
Gulp, Bower, Bootstrap Sass, FontAwesome
View bower.json
{
"name": "project",
"version": "0.0.0",
"authors": [
"Eric Barnes <me@example.org>"
],
"license": "MIT",
"private": true,
"ignore": [
"**/.*",
@ericlbarnes
ericlbarnes / app.js
Created Jul 22, 2015
Example delete request
View app.js
$(document).ready(function() {
$("button.remove").on('click', function(e){
e.preventDefault();
if ( ! confirm('Are you sure?')) {
return false;
}
var action = $(this).data("action");
var parent = $(this).parent();
$.ajax({
type: 'delete',
View selectize.js
this.selectize = this.$("#js-tags").selectize({
persist: true,
maxItems: null,
valueField: "tag",
labelField: "tag",
searchField: ["tag"],
options: tags.toJSON(), // Backbone collection
render: {
item: function(item) {
return "<div><i class='icon-tag'></i> " + item.tag + "</div>";
@ericlbarnes
ericlbarnes / beartagcons.txt
Created Jan 6, 2018
A list of all the Bear Writing app sidebar icons
View beartagcons.txt
#android
#apple
#apple watch#
#bear
#comics
* saitama
* one punch man
* one-punch man
* one punch-man
* onepunch-man