Skip to content

Instantly share code, notes, and snippets.

View seafarer's full-sized avatar
☎️
DM me, maybe

Colin OBrien seafarer

☎️
DM me, maybe
View GitHub Profile
@seafarer
seafarer / functions.php
Last active August 13, 2022 00:52
Use Laravel Mix with a basic WordPress theme like Underscores. So much easier than messing around with Gulp etc.
<?php
/**
* Take advantage of Mix's cache busting function
*/
function asset( $path ) {
// Asset manifest file from Mix
$manifest = get_template_directory_uri() . '/dist/mix-manifest.json';
$manifest_array = json_decode(file_get_contents($manifest), true);
@seafarer
seafarer / nginx-rewrite.conf
Created October 3, 2016 17:14
301 redirect .html to non .html for nginx
rewrite ^(/.*)\.html(\?.*)?$ $1$2 permanent;
rewrite ^/(.*)/$ /$1 permanent;
try_files $uri/index.html $uri.html $uri/ $uri =404;
@seafarer
seafarer / template.php
Created October 20, 2015 15:40 — forked from gildotdev/template.php
Drupal 7 hook method to remove cache busting query strings on css and js files. Related to this post https://drupal.org/node/242875
<?php
/**
* Implements hook_process_html
*/
function templatenamespace_process_html(&$vars) {
$search = array('scripts' => 'src=', 'styles' => 'href=', 'styles' => '@import\surl\(');
foreach ( $search as $var => $word ) {
if ( !empty($vars[$var]) ) {
add_action( 'wp_dashboard_setup', 'register_my_dashboard_widget' );
function register_my_dashboard_widget() {
wp_add_dashboard_widget(
'my_dashboard_widget',
'My Dashboard Widget',
@seafarer
seafarer / respond-to.scss
Last active August 29, 2015 14:20
respond to mixin
$small-screen: 480px;
$medium-screen: 768px;
$large-screen: 960px;
$huge-screen: 1232px;
$breakpoints: (
'small': ( max-width: $small-screen ),
'small-up': ( min-width: $small-screen ),
'medium': ( max-width: $medium-screen ),
'medium-up': ( min-width: $medium-screen ),
@seafarer
seafarer / package.json
Created March 19, 2015 02:46
a package json to go with my gulpfile
{
"name": "vrweb",
"version": "0.0.1",
"description": "Front end tasks for rezFusion",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git://github.com/bluetent/vrweb-D7"
@seafarer
seafarer / Gulpfile.js
Created March 19, 2015 02:45
Basic gulpfile to compile sass with libsass and autoprefixer and reload the browser. Also has a function for a custom icon font.
/**
* Front end tasks.
*/
var gulp = require('gulp');
var gutil = require('gulp-util');
var plumber = require('gulp-plumber');
var sass = require('gulp-sass');
var sourcemaps = require('gulp-sourcemaps');
var autoprefixer = require('gulp-autoprefixer');
# Requre a specific version in this file:
# gem 'zurb-foundation', '=4.3.1'
require 'zurb-foundation'
# Require any additional compass plugins here.
class Splitter
MAX_SELECTORS_DEFAULT = 4095
@seafarer
seafarer / SassMeister-input-HTML.html
Created July 9, 2014 02:11
Generated by SassMeister.com.
<button class="image-stack"></button>
<button class="home"></button>
<button class="select-image"></button>
<button class="launch-camera"></button>
<button class="my-location"></button>
@seafarer
seafarer / respond-to-with-fallback.scss
Created April 28, 2014 20:16
Simple mixin for throwing a fallback class on min width media query for IE. Via http://www.alwaystwisted.com/post.php?s=2012-08-06-a-sass-mixin-for-media-queries-and-ie
@mixin respond-to($media) {
@media #{$media} {
@content
}
}
@mixin respond-to-fallback($media, $wrapper-class) {
.#{$wrapper-class} & {
@content;
}