Skip to content

Instantly share code, notes, and snippets.

@Grabes
Grabes / README.md
Last active January 6, 2018 01:04 — forked from claytonrcarter/README.md
Share named routes between Laravel and Javascript

Share named routes between Laravel and Javascript

This is a 2-part technique to share named routes between Laravel and Javascript. It uses a custom artisan command to export your named routes to JSON, and a Javascript route() helper to lookup the route and fill in any parameters. Written for Laravel 5.3; not tested in 5.4.

Installation

1. Install RouteJson.php

Copy RouteJson.php into your app as app/Console/Commands/RouteJson.php

@Grabes
Grabes / alias-docker-compose.sh
Last active September 25, 2017 18:26 — forked from maxclaus/alias-docker-compose.sh
Aliases for docker-compose
alias c='docker-compose'
alias cb='docker-compose build'
alias cup='docker-compose up'
alias cup='docker-compose up -d'
alias cr='docker-compose run --service-ports --rm'
alias crl='docker-compose run --service-ports --rm local'
alias crd='docker-compose run --service-ports --rm develop'
alias crt='docker-compose run --rm test'
alias crp='docker-compose run --rm provision'
alias crci='docker-compose run --rm ci'
@Grabes
Grabes / slack.php
Created September 8, 2017 17:28
Send to slack
<?php
// (string) $message - message to be passed to Slack
// (string) $room - room in which to write the message, too
// (string) $icon - You can set up custom emoji icons to use with each message
public static function slack($message, $room = "engineering", $icon = ":longbox:") {
$room = ($room) ? $room : "engineering";
$data = "payload=" . json_encode(array(
"channel" => "#{$room}",
"text" => $message,
"icon_emoji" => $icon
@Grabes
Grabes / focus-within.js
Created July 27, 2017 19:12 — forked from aFarkas/focus-within.js
simple focus-within polyfill
(function(window, document){
'use strict';
var slice = [].slice;
var removeClass = function(elem){
elem.classList.remove('focus-within');
};
var update = (function(){
var running, last;
var action = function(){
var element = document.activeElement;
@Grabes
Grabes / a.md
Last active April 17, 2017 16:46 — forked from danharper/a.md
Laravel Queue Supervisor

Install Supervisor with sudo apt-get install supervisor. Ensure it's started with sudo service supervisor restart.

In /etc/supervisord/conf.d/ create a .conf file. In this example, laravel_queue.conf (contents below). Give it execute permissions: chmod +x laravel_queue.conf.

This file points at /usr/local/bin/run_queue.sh, so create that file there. Give this execute permissions, too: chmod +x run_queue.sh.

Now update Supervisor with: sudo supervisorctl reread. And start using those changes with: sudo supervisorctl update.

@Grabes
Grabes / local.xml
Created August 26, 2016 22:49 — forked from Maksold/local.xml
Magento XML - local.xml boilerplate
<?xml version="1.0"?>
<layout>
<default>
<!--Root/Default Layouts-->
<reference name="root">
<!--Appending Block-->
<block type="page/html_breadcrumbs" name="breadcrumbs" as="breadcrumbs"/>
</reference>
<!--CSS and JS Files-->
<!doctype html>
<html class="no-js" lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Foundation Mega Menu</title>
<link rel="stylesheet" href="css/app.css" />
<link href="http://cdnjs.cloudflare.com/ajax/libs/foundicons/3.0.0/foundation-icons.css" rel="stylesheet">
<script src="bower_components/modernizr/modernizr.js"></script>
</head>
@Grabes
Grabes / tgt-magento-subscribers.php
Created March 29, 2016 18:09 — forked from kontikidigital/tgt-magento-subscribers.php
Export Magento Newsletter Subscribers
<?php
/*
Extension Name: Magento CSV Export Newsletter Subscribers
Description: Export a list of subscribers of the Magento Newsletter in CSV format
Version: 0.1
License: GPL
Author: TargetIMC
Author URI: http://targetimc.com
*/
/* Paste this file in root directory and run it manually*/
@Grabes
Grabes / vvv-blueprints.json
Created December 18, 2015 06:11
VV Blueprints
{
"dev-plugin":{
"mu_plugins":[
{
"location":"https://github.com/norcross/airplane-mode.git"
}
],
"plugins":[
{
"location":"query-monitor",
<?php
// standard usage
new GW_Submission_Limit( array(
'form_id' => 86,
'limit' => 2,
) );
// all options
new GW_Submission_Limit( array(