Skip to content

Instantly share code, notes, and snippets.

@frankdejonge
frankdejonge / gist:5c19f8e7ce329dbcc1ef
Created Jun 10, 2014
Flysystem and user downloads
View gist:5c19f8e7ce329dbcc1ef
<?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 Oct 2, 2019
Sample Modular Templating for Craft CMS - Inspired by principles from https://smacss.com/.
View _base.twig
<!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 Jun 19, 2017
JSConf 2014 Slides, Codes and Notes.
View jsconf_slides_codes_and_notes.md

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 Feb 27, 2014
Use atom from the command line
View at.sh
ln -s /Applications/Atom.app/Contents/Resources/app/atom.sh ~/bin/atom
View setup_php_code_sniffer_in_sublime_text.md

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 May 11, 2021
My .vimrc file
View .vimrc
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 Aug 7, 2013
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.
View gist:6176883
alias sshkey="cat ~/.ssh/id_rsa.pub | pbcopy && echo 'Copied to clipboard.'"
@kendellfab
kendellfab / goto-sublime
Created Aug 1, 2013
Add mouse click `goto definition` in sublime text 3.
View goto-sublime
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",
View restfulizer.js
/**
* 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 Mar 18, 2013
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.
View wp-config.php
/* 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');