Skip to content

Instantly share code, notes, and snippets.

View jpgninja's full-sized avatar
🎯
Got a ton of interesting projects going on, and loving it.

Chris Mewhort jpgninja

🎯
Got a ton of interesting projects going on, and loving it.
View GitHub Profile
@mixin for-phone-only {
@media (max-width: 599px) { @content; }
}
@mixin for-tablet-portrait-up {
@media (min-width: 600px) { @content; }
}
@mixin for-tablet-portait-only {
@media (min-width: 600px) and (max-width: 899px) { @content; }
}
@mixin for-tablet-landscape-up {
order deny,allow
deny from all
allow from 127.0.0.1
@jpgninja
jpgninja / migrate-wordpress-db.sql
Last active February 3, 2017 07:18
Quick way to update WordPress DB during migration. Eliminates the need for running Find & Replace.
/* HTTP */
UPDATE wp_options SET option_value = replace(option_value, 'http://OLDDOMAIN.com', 'http://NEWDOMAIN.com') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'http://OLDDOMAIN.com','http://NEWDOMAIN.com');
UPDATE wp_posts SET post_content = replace(post_content, 'http://OLDDOMAIN.com', 'http://NEWDOMAIN.com');
/* HTTP + WWW */
UPDATE wp_options SET option_value = replace(option_value, 'http://www.OLDDOMAIN.com', 'http://NEWDOMAIN.com') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'http://www.OLDDOMAIN.com','http://NEWDOMAIN.com');
UPDATE wp_posts SET post_content = replace(post_content, 'http://www.OLDDOMAIN.com', 'http://NEWDOMAIN.com');
@jpgninja
jpgninja / pert-bookmarklet.js
Last active March 15, 2017 19:47
PERT Estimation bookmarklet
javascript:(function(){let best=parseInt(prompt("Your best case scenario : ", "1000"), 10),amt=(((best*8)+(best)+(best*6))/6);alert('Total estimate: '+amt);})();
/* Here it is laid out: */
(function(){
let best=parseInt(prompt("Your best case scenario : ", "1000"), 10),
amt=(((best*8)+(best)+(best*6))/6);
alert('Total estimate: ' + amt);
})();
/**
* Is blog page
*
*/
function is_blog() {
return ( (is_archive()) || (is_author()) || (is_category()) || (is_home()) || (is_single()) || (is_tag()) ) ? true : false ;
}
<?php
/**
* Clip blog post excerpts
*
*/
add_filter('get_the_excerpt','excerpt_char_limit');
function excerpt_char_limit($e){
return substr($e,0,150) . '&hellip;';
}
/**
* Vertical Align (Mixins)
*
*/
.vertical-align(@position: relative, @offset: 50%) {
top: @offset;
position: @position;
-webkit-transform: translateY(-@offset);
-ms-transform: translateY(-@offset);
transform: translateY(-@offset);
let ppokes = $$('._xco ._42us a');for(ppoke in ppokes){ document.writeln(ppokes[ppoke].innerHTML + ', '+ ppokes[ppoke].href +'<br>' ); };
@jpgninja
jpgninja / gulpfile.js
Created January 5, 2018 15:08
Default gulpfile.js that I seem to pass from project to project.
var gulp = require('gulp');
var express = require('express');
var lr = require('tiny-lr')();
var browserify = require('browserify');
var source = require('vinyl-source-stream');
var less = require('gulp-less');
var minify = require('gulp-minify');
var minifycss = require('gulp-minify-css');
var transform = require('vinyl-transform');
var less = require('gulp-less');
@jpgninja
jpgninja / cmma_boostrap.js
Last active November 11, 2018 18:25
CMMA Skinner
var cmma_bootstrap = () => {
let until,
i = 0,
cmma_bg_img = "https://imagesvc.timeincapp.com/v3/fan/image?url=https%3A%2F%2Fcagepages.com%2Fwp-content%2Fuploads%2Fgetty-images%2F2016%2F08%2F596465956-ufc-202-diaz-v-mcgregor-2.jpg",
cmma_pg_title = "UFC Fight Night 139 :: Korean Zombie vs. Yair Rodriguess :: Coast MMA Live Stats",
cmma_remove_list = [
'#header',
'#fightTickerContainer',
'#subtitleContainer',