Skip to content

Instantly share code, notes, and snippets.

View nateritter's full-sized avatar
🎯
Focusing

Nate Ritter nateritter

🎯
Focusing
View GitHub Profile
@CristinaSolana
CristinaSolana / gist:1885435
Created February 22, 2012 14:56
Keeping a fork up to date

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@TfTHacker
TfTHacker / FastStart-StartupScript.js
Last active April 1, 2024 06:39
FastStart Script for Obsidian - makes it easy to delay the startup of plugins
<%*
fastStart = async (filename, delayInSecond) => {
if (tp.file.exists(filename)) {
const f = tp.file.find_tfile(filename);
let plugins = (await app.vault.read(f)).split(/\r?\n/);
setTimeout(async () => {
plugins.forEach(async (p) => await app.plugins.enablePlugin(p))
}, delayInSecond * 1000)
}
}
@paulund
paulund / phpcs.xml
Created August 20, 2017 16:50
PHP PSR-2 CodeSniffer Config for Laravel
<?xml version="1.0"?>
<ruleset name="Laravel Standards">
<!--
The name attribute of the ruleset tag is displayed
when running PHP_CodeSniffer with the -v command line
argument. The description tag below is not displayed anywhere
except in this file, so it can contain information for
developers who may change this file in the future.
-->
@soufianeEL
soufianeEL / laravel.js
Last active June 18, 2023 05:25 — forked from JeffreyWay/laravel.js
You use Laravel 5 and you want to send a DELETE request without creating a form? This will handle the form-creation bits for you dynamically, similar to the Rails implementation. To use, import script, and create a link with the `data-method="DELETE"` and `data-token="{{csrf_token()}}"` attributes.
/*
Exemples :
<a href="posts/2" data-method="delete" data-token="{{csrf_token()}}">
- Or, request confirmation in the process -
<a href="posts/2" data-method="delete" data-token="{{csrf_token()}}" data-confirm="Are you sure?">
*/
(function() {
@mystix
mystix / setup-php-dev.sh
Last active April 27, 2023 15:46
(OSX 10.7.x/10.8.x + Homebrew + nginx + mysql + php 5.4 + php-fpm + apc + xdebug) development environment
#!/bin/bash
# install homebrew's official php tap
brew tap josegonzalez/homebrew-php
# install homebrew-dupes (required to install zlib, php54's dependency)
brew tap homebrew/dupes
# install nginx + mysql + php 5.4 + php-fpm + apc + xdebug
brew install nginx mysql
@thijskok
thijskok / config.yml
Last active April 4, 2023 05:47
CircleCI 2.0 Laravel build configuration with PHP 7.1, NodeJS, and MySQL support. Runs both PHPunit as well as Laravel Dusk. Proper GD configuration for image editing purposes. Several linters included (requires including them in composer / package.json).
version: 2
jobs:
build:
working_directory: ~/user/repo
environment:
BASH_ENV: ~/.bashrc
docker:

UsedByTeams Model Trait For Laravel Spark

Automatically limit your models to the current team

So you're using spark, and you have teams enabled. You start creating models and want to have them be team specific. Instead of writing, Model::where('team_id', auth()->user()->currentTeam->id)->get(); use this trait to add that behind the scenes so that every time you call on your model, it's assumed that you mean for the current team.

This assumes that the model has a team_id, while it adds a scope of where team_id = currentTeam->id.

Note: Implicit Route Model Binding in 5.2, auth session doesn't exist at the point of this trait causing issue. fixed in 5.3

@dillinghamio
dillinghamio / SparkRoleMiddleware.md
Last active April 8, 2022 03:50
Team Role Middleware For Laravel Spark

Team Role Middleware For Laravel Spark

Makes it simple to use Spark's role feature on routes

Route::group(['middleware'=>'role:owner'], function(){
    // owners only
});

Route::group(['middleware'=>'role:member'], function(){
@MrDrews
MrDrews / Default.sublime-theme
Created April 22, 2013 13:41
Solarized (light) -- Complement the stock Solarized (light) theme in sublime text 3 by placing this `Default.sublime-theme` inside the `Packages/User` folder. It will recolor the sidebar.
[
{
"class": "sidebar_container",
// $base02: #073642
"layer0.tint": [7,54,66],
"layer0.opacity": 1.0,
"layer0.draw_center": false,
"layer0.inner_margin": [0, 0, 1, 0],
"content_margin": [0, 0, 1, 0]