Skip to content

Instantly share code, notes, and snippets.

Tommy Marshall tommymarshall

Block or report user

Report or block tommymarshall

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@dillinghamio
dillinghamio / @role.md
Last active May 30, 2019
@ROLE Blade Directive For Laravel Spark
View @role.md

@role Blade Directive For Laravel Spark

Assumes you're using teams

Add this to the boot() method of your AppServiceProvider

\Blade::directive('role', function($roles) {

        $user = auth()->user();
@rileypaulsen
rileypaulsen / functions.php
Created Aug 19, 2014
Add Advanced Custom Fields Fields to the WP REST API
View functions.php
function wp_api_encode_acf($data,$post,$context){
$data['meta'] = array_merge($data['meta'],get_fields($post['ID']));
return $data;
}
if( function_exists('get_fields') ){
add_filter('json_prepare_post', 'wp_api_encode_acf', 10, 3);
}
@tommymarshall
tommymarshall / routes.php
Last active Jan 8, 2017
Simple Laravel + Craft integration
View routes.php
<?php
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the Closure to execute when that URI is requested.
@rbin
rbin / scss2sass.sh
Created Jan 30, 2013
Look for any SCSS files in a Directory, and change them to minimal-style .sass! (The better version!
View scss2sass.sh
#!/bin/bash
for f in *.scss; do sass-convert $f ${f%scss}sass ; done
rm *.scss
View rem-calibrate.css
/* Android stock browser won't let you set font-size smaller than 8px unless you apply this. */
:root {
-webkit-text-size-adjust: none;
-moz-text-size-adjust: none;
-ms-text-size-adjust: none;
-o-text-size-adjust: none;
text-size-adjust: none;
}
@averyvery
averyvery / Guardfile
Created Jul 3, 2012
Retina images with Guard
View Guardfile
guard 'process', :name => 'shrink-images', :command => 'ruby resize-mobile-images.rb mobileretina' do
watch /^images\/mobileretina\/.+/
end
@nhunzaker
nhunzaker / gist:2830256
Created May 29, 2012
My FED Pre-Commit Hook
View gist:2830256
#!/usr/bin/env ruby
errors = false
# Create a simple line break
puts ""
# Now let's get a list of the changed files that have been staged
changed_files = `git diff --staged --name-only HEAD`.split("\n")
@jgarber623
jgarber623 / _layout.php
Created May 1, 2012
Basic layout/view-style templating with PHP
View _layout.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title><?php echo $page_title; ?></title>
</head>
<body>
<?php echo $content_for_layout; ?>
@jlong
jlong / uri.js
Created Apr 20, 2012
URI Parsing with Javascript
View uri.js
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@lqez
lqez / gist:2404749
Created Apr 17, 2012
Modified swipe.js to get callback point on beginning swipe.
View gist:2404749
/*
* Swipe 1.0
*
* Brad Birdsall, Prime
* Copyright 2011, Licensed GPL & MIT
*
*/
window.Swipe = function(element, options) {
You can’t perform that action at this time.