Skip to content

Instantly share code, notes, and snippets.

View J5Dev's full-sized avatar

Chris Gooding J5Dev

  • Yorkshire, United Kingdom
View GitHub Profile
@J5Dev
J5Dev / BaseModel.php
Last active August 29, 2015 14:02
Laravel Base model for use with model based validation, compensating for Unique on update
<?php
use Eloquent, Validator;
/**
* Class BaseModel
*
* @package
*/
class BaseModel extends Eloquent {
@J5Dev
J5Dev / NavLinkMacro.php
Last active August 29, 2015 14:02
Laravel 4 HTML macro to generate link within a list from a string or route, including active status if current url
<?php
HTML::macro('navLink', function ($route, $text, $listAttributes = [], $linkAttributes = [], $params = null, $secure = null)
{
# Set default attributes
$listDefaults = ['class' => ''];
$linkDefaults = ['class' => ''];
// Merge default attributes with those supplied
$listAttributes = $listDefaults + ($listAttributes == null ? [] : $listAttributes);
@J5Dev
J5Dev / gulpfile.js
Last active August 29, 2015 14:03
Gulp files to process all sass & js files then compress them. used within Laravel app with admin-site separation using Zurb Foundation
var gulp = require('gulp');
var gutil = require('gulp-util');
var autoprefixer = require('gulp-autoprefixer');
var minifycss = require('gulp-minify-css');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
var notify = require('gulp-notify');
var sass = require('gulp-ruby-sass');
var phpunit = require('gulp-phpunit');
var concat = require('gulp-concat');
@J5Dev
J5Dev / jQuery.footerSticker.js
Created July 16, 2014 18:19
jQueryFooterSticker - Works on browser resize without any css markup required
$(window).resize(function () {
var footer = $("footer");
var pos = footer.position();
var height = $(window).height();
height = height - pos.top;
height = height - footer.outerHeight();
if (height > 0) {
footer.css({
'margin-top': height + 'px'
});
@J5Dev
J5Dev / Foundation.Animated.Acordian.js
Created July 17, 2014 08:42
Animated Accordion for Zurbs Foundation Acordian
$(function() {
$(".accordion").on("click", "dd", function () {
$("dd.active").find(".content").slideUp("slow");
if (!$(this).hasClass("active")) {
$(this).find(".content").slideToggle("slow");
}
});
});
@J5Dev
J5Dev / .gitattributes
Created January 10, 2018 10:17
Unity Git Settings
# Auto detect text files and perform LF normalization
* text=auto
# 3D models
*.3dm filter=lfs diff=lfs merge=lfs -text
*.3ds filter=lfs diff=lfs merge=lfs -text
*.blend filter=lfs diff=lfs merge=lfs -text
*.c4d filter=lfs diff=lfs merge=lfs -text
*.collada filter=lfs diff=lfs merge=lfs -text
*.dae filter=lfs diff=lfs merge=lfs -text
root@rec5ba001t:~# wget -O forge.sh "https://forge.laravel.com/servers/<SERVER_ID>/vps?forge_token=<FORGE_TOKEN>"; bash forge.sh
--2018-08-07 16:24:36-- https://forge.laravel.com/servers/222164/vps?forge_token=<FORGE_TOKEN>
Resolving forge.laravel.com (forge.laravel.com)... 104.25.9.32, 104.25.8.32, 2400:cb00:2048:1::6819:920, ...
Connecting to forge.laravel.com (forge.laravel.com)|104.25.9.32|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: 'forge.sh'
forge.sh [ <=> ] 11.77K --.-KB/s in 0s
@J5Dev
J5Dev / Deploy project error
Created August 8, 2018 15:03
Forge Custom VPS setup issues 2
Cloning into 'forge-test.j5dev.co.uk'...
Warning: Permanently added the RSA host key for IP address '192.30.253.112' to the list of known hosts.
/home/forge/.forge/provision-20157059.sh: line 28: composer: command not found
@J5Dev
J5Dev / .env
Created January 17, 2019 17:21
Good git ignore for laravel
/node_modules
/public/hot
/public/storage
/storage/*.key
/vendor
/.idea
/.vagrant
/.composer
Homestead.json
Homestead.yaml
@J5Dev
J5Dev / ParseInputStream.php
Last active June 3, 2019 12:07 — forked from devmycloud/ParseInputStream.php
Process php://input to get multipart/form-data parameters for PATCH API request
<?php
namespace App\Services;
use Illuminate\Support\Facades\Log;
use Symfony\Component\HttpFoundation\File\UploadedFile;
/**
* stream - Handle raw input stream
*