Skip to content

Instantly share code, notes, and snippets.

@craigmdennis
craigmdennis / remove.php
Last active August 29, 2015 14:06
Remove menus for specific users in Wordpress
<?php
add_action( 'admin_menu', 'remove_menus' );
function remove_menus() {
global $menu;
global $submenu;
// echo '<pre>';
// print_r($menu);
@craigmdennis
craigmdennis / _debug-breakpoint.scss
Last active August 29, 2015 14:06
A simple way to help identify which breakpoint you're in when using $variables as media query values.
$debug-breakpoint: true;
$bp1: 'min-width: 20em'; // 320px
$bp2: 'min-width: 30em'; // 480px
$bp3: 'min-width: 37.5em'; // 600px
$bp4: 'min-width: 48em'; // 768px
$bp5: 'min-width: 56.25em'; // 900px
$bp6: 'min-width: 68.75em'; // 1100px
$bp7: 'min-width: 81.25em'; // 1300px
@craigmdennis
craigmdennis / _flourish.scss
Last active August 29, 2015 14:06
Scoped Typography
.context__flourish {
ul {
list-style: disc;
margin-left: 1.5em; /* Left and right margins are allowed here */
}
}
@craigmdennis
craigmdennis / _twitter.jade
Last active August 29, 2015 14:06
Twitter Card <meta> in jade
meta(name="twitter:card", content="summary")
meta(name="twitter:site", content="@craigmdennis")
meta(name="twitter:title", content="{{title}}")
meta(name="twitter:description", content="{{description}}")
meta(name="twitter:img", content="http://craigmdennis.com/logo.png")
meta(name="twitter:url", content="{{url}}")
@craigmdennis
craigmdennis / ssh.md
Last active August 29, 2015 14:06
Setting up capistrano and ssh access on new server

Setting up capistrano and ssh access on new server

When getting an error 'git-ssh.sh': Permission denied add set :tmp_dir, "/home/{username}/tmp" to the deploy.rb file.

1. Copy local ssh public key to clipboard

'pbcopy < ~/.ssh/id_rsa.pub'

2. Add clpboard contents to authorized_hosts

vim authorized_hosts

@craigmdennis
craigmdennis / network-colors.scss
Created October 20, 2014 23:11
Iterate through a SASS map and out put different results based on the variable type
// Social Network Colours
$network-colors: (
twitter: #00ACED,
youtube: #CD201F,
pinterest: #CB2027,
github: #333333,
dribbble: #EA4C88,
instagram: #517FA4
);
@craigmdennis
craigmdennis / helpers.scss
Last active August 29, 2015 14:10
Toolkit: Common @Mixins and helpers commonly used in projects
%clearfix {
&:after {
content: "";
display: table;
clear: both;
}
}
@craigmdennis
craigmdennis / kirby-title.php
Last active August 29, 2015 14:10
Show all parent page titles in the HTML `<title>` tag using Kirby
<?php
// Start off with an empty $title
$title = '';
// Get all the parents (except the homepage) and reverse the array
$parents = $site->breadcrumb()->not('home')->flip();
// Iterate over the array
foreach ($parents AS $parent) :
@craigmdennis
craigmdennis / jquery-plugin-template.coffee
Last active August 29, 2015 14:13 — forked from rjz/cs-jq-plugin-template.coffee
A class-based template for jQuery plugins in Coffeescript
# $('.target').myPlugin();
# $('.target').myPlugin({ paramA: 'not-foo' });
# $('.target').myPlugin('myMethod', 'Hello, world');
do($ = window.jQuery, window) ->
# Define the plugin class
class MyPlugin
defaults:
@craigmdennis
craigmdennis / gulpfile.coffee
Created March 11, 2015 01:05
Deploy to GitHub pages with Gulp
"use strict"
# Include gulp
gulp = require 'gulp'
# Include Our Plugins
jshint = require 'gulp-jshint'
jade = require 'gulp-jade'
del = require 'del'