Skip to content

Instantly share code, notes, and snippets.

View mattstauffer's full-sized avatar

Matt Stauffer mattstauffer

View GitHub Profile
@frankdejonge
frankdejonge / gist:5c19f8e7ce329dbcc1ef
Created June 10, 2014 18:38
Flysystem and user downloads
<?php
$stream = $fs->readStream($file);
// send the right headers
header("Content-Type: " . $fs->getMimetype($file));
header("Content-Length: " . $fs->getSize($file));
header("Content-disposition: attachment; filename=\"" . basename($file) . "\"");
// dump the attachement and stop the script
@wesrice
wesrice / _base.twig
Last active October 2, 2019 18:02
Sample Modular Templating for Craft CMS - Inspired by principles from https://smacss.com/.
<!DOCTYPE html>
<head>
{# Base #}
{% includeCssFile 'layouts/base/css/base.css' %}
{% includeJsFile 'layouts/base/js/base.js' %}
{# Header #}
{% includeCssFile 'modules/header/css/header.css' %}
{% includeJsFile 'modules/header/js/header.js' %}
@airportyh
airportyh / jsconf_slides_codes_and_notes.md
Last active June 19, 2017 20:51
JSConf 2014 Slides, Codes and Notes.

JSConf Slides, Codes and Notes

These are all the JSConf 2014 slides, codes, and notes I was able to cull together from twitter. Thanks to the speakers who posted them and thanks to @chantastic for posting his wonderful notes.

Modular frontend with NPM - Jake Verbaten (@Raynos)

@rtablada
rtablada / at.sh
Created February 27, 2014 14:33
Use atom from the command line
ln -s /Applications/Atom.app/Contents/Resources/app/atom.sh ~/bin/atom

Setup PHP Code Sniffer in Sublime Text

The PHP Code Sniffer helps identity violations again coding standards (ie. PSR) as well as syntax errors in your code. The following tutorial explains how to setup the PHP Code Sniffer in Sublime Text (on OSX). This has been tested in Sublime Text 2 and Sublime Text 3.

1. Install PHP_CodeSniffer

Using Pear

You can use Pear, but that's just confusing, and requires you to have Pear installed. Move on to the next option.

@JeffreyWay
JeffreyWay / .vimrc
Last active January 22, 2024 11:42
My .vimrc file
set nocompatible " Disable vi-compatibility
set t_Co=256
colorscheme xoria256
set guifont=menlo\ for\ powerline:h16
set guioptions-=T " Removes top toolbar
set guioptions-=r " Removes right hand scroll bar
set go-=L " Removes left hand scroll bar
set linespace=15
@JeffreyWay
JeffreyWay / gist:6176883
Created August 7, 2013 18:19
Add this to your bash_profile. Now, whenever you need to fetch your ssh-key, just type sshkey, and it'll be copied to your clipboard.
alias sshkey="cat ~/.ssh/id_rsa.pub | pbcopy && echo 'Copied to clipboard.'"
@kendellfab
kendellfab / goto-sublime
Created August 1, 2013 20:53
Add mouse click `goto definition` in sublime text 3.
Linux - create "Default (Linux).sublime-mousemap" in ~/.config/sublime-text-3/Packages/User
Mac - create "Default (OSX).sublime-mousemap" in ~/Library/Application Support/Sublime Text 3/Packages/User
Win - create "Default (Windows).sublime-mousemap" in %appdata%\Sublime Text 3\Packages\User
[
{
"button": "button1",
"count": 1,
"modifiers": ["ctrl"],
"press_command": "drag_select",
/**
* Taken from http://paste.laravel.com/b8n
* and added a datum attr to submit data along with the RESTful request
*
* Restfulize any hiperlink that contains a data-method attribute by
* creating a mini form with the specified method and adding a trigger
* within the link.
* Requires jQuery!
*
* Ex in Laravel:
@MattWilcox
MattWilcox / wp-config.php
Created March 18, 2013 14:38
Bits to add to wp-config.php to make things sane when developing in a real development system (local > stage > live) instead of developing directly on a live server. Which is what WP is set up to do and which is ridiculous.
/* Lets not rely on paths in the database, they can be very wrong when moving between dev/stage/live environments */
/* The following two variables are backward to my thinking, but hey, what ya gonna do? */
define('WP_HOME', 'http://' . $_SERVER['HTTP_HOST'] . ''); // This is NOT the 'wordpress admin area' home, but the site's home
define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST'] . '/SECRETDIRECTORY'); // This isn't the site's URL but the WordPress admin area URL
/* MySQL settings */
switch($_SERVER['SERVER_NAME']){
// Your local machine's settings
case 'mysite.local':
define('DB_NAME', 'dev_mysite');