Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am nmec on github.
  • I am nmec (https://keybase.io/nmec) on keybase.
  • I have a public key ASDuZ-ee6aL9YQQ6eGrwAkaGUYuxPn7J6Kk2Hju2FviEago

To claim this, I am signing this object:

@nmec
nmec / gulp-modernizr.js
Last active January 31, 2019 17:15
A very simple gulp task for compiling a custom modernizr build.
'use strict';
var fs = require('fs');
var gulp = require( 'gulp' );
var modernizr = require('modernizr');
var config = require('./modernizr-config'); // path to JSON config
gulp.task( 'modernizr', function (done) {
modernizr.build(config, function(code) {
@nmec
nmec / sass-mq.sublime-snippet
Created March 29, 2014 16:46
Sublime Text snippet for Sass media queries.
<snippet>
<content><![CDATA[
@media #{\$${1:medium-up}} {
${2:/* Styles */}
}
]]></content>
<tabTrigger>media</tabTrigger>
<scope>source.scss</scope>
<description>Sass Media Query</description>
</snippet>
@nmec
nmec / no-knab.js
Created January 19, 2014 16:58
Prevent opportunistic image thieves.
jQuery(document).ready(function($){
// Prevent right click on carousel
$('.gallery').on('contextmenu', function(){
return false;
});
// Prevent right click on all image elements
$('img').on('contextmenu', function(){
return false;
@nmec
nmec / jsonview-tomorrow-night.css
Created December 26, 2013 14:55
JSONView - Tomorrow Night Theme
body {
white-space: pre;
font-family: Menlo, Monaco, monospace;
font-size: 0.8rem;
background: #1d1f21;
color: #c5c8c6;
}
.property {
@nmec
nmec / install.php
Last active December 10, 2015 12:28
Prevents generation of 'Hello World' and 'Sample Page' in WordPress, just drop this file in your wp-content folder before running the installation.
<?php
/**
* Prevents generation of 'Hello World' and 'Sample Page'.
* @link http://wordpress.stackexchange.com/a/71867/8872
*/
function wp_install_defaults() {
return null;
}
<?php
// Remove SEO menu from Admin bar
add_action( 'wp_before_admin_bar_render', 'mytheme_admin_bar_render' );
function mytheme_admin_bar_render() {
global $wp_admin_bar;
$wp_admin_bar->remove_menu('wpseo-menu');
}
// Remove ‘page analysis’ and annoying SEO columns
add_filter( 'wpseo_use_page_analysis', '__return_false' );
@nmec
nmec / WP-3.4.php
Created September 7, 2012 08:27
Sorting a WordPress loop by post__in
<?php
$posts = array(5, 2, 43, 12);
// Get the posts
$my_loop = new WP_Query(array(
'post__in' => $posts,
'post_type' => 'any',
'posts_per_page' => -1,
));
@nmec
nmec / gist:2894318
Created June 8, 2012 07:56
Change default WordPress new user notifications
<?php
/**
* Prevent new user email notifications
* This prevents new user email notifications being sent to users and administrators by commenting out the wp_mail functions. You could rewrite it to change the default registration email.
* This should be put in a plugin or your themes functions file.
* @link http://wordpress.org/extend/plugins/disable-wp-new-user-notification/
* @author Jono Warren <jonathan_warren@bcl.co.uk>
*/
if ( !function_exists('wp_new_user_notification') ) {
function wp_new_user_notification($user_id, $plaintext_pass = '') {
@nmec
nmec / gist:1518329
Created December 24, 2011 20:57
Disable the internal laptop screen in OS X Lion: http://nmecdesign.com/?p=288 NB You need to restart for the changes to take effect
sudo nvram boot-args="iog=0x0"