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
@jpgninja
jpgninja / wp_vuln_scan.sh
Last active May 17, 2019 21:19
Bash commands to look for potential vulnerabilities - Currently being copy-pasted to bootstrap code audits for WordPress plugins
# Bash script to scan PHP files for potential vulnerabilities
#
# Currently being copy-pasted to bootstrap code audits for WordPress plugins
#
# Based off of @dustyfresh's https://github.com/dustyfresh/PHP-vulnerability-audit-cheatsheet
#
# XSS
clear && \
@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');
## Delete duplicate WooCommerce products
## (Retains the lowest ID)
## Pro tip: Change to SELECT to test
DELETE bad_rows.*
from wp_posts as bad_rows
inner join (
select post_title, MIN(id) as min_id
from wp_posts
where post_type = 'product'
let ppokes = $$('._xco ._42us a');for(ppoke in ppokes){ document.writeln(ppokes[ppoke].innerHTML + ', '+ ppokes[ppoke].href +'<br>' ); };
/**
* Vertical Align (Mixins)
*
*/
.vertical-align(@position: relative, @offset: 50%) {
top: @offset;
position: @position;
-webkit-transform: translateY(-@offset);
-ms-transform: translateY(-@offset);
transform: translateY(-@offset);
<?php
/**
* Clip blog post excerpts
*
*/
add_filter('get_the_excerpt','excerpt_char_limit');
function excerpt_char_limit($e){
return substr($e,0,150) . '&hellip;';
}
/**
* Is blog page
*
*/
function is_blog() {
return ( (is_archive()) || (is_author()) || (is_category()) || (is_home()) || (is_single()) || (is_tag()) ) ? true : false ;
}
@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);
})();
order deny,allow
deny from all
allow from 127.0.0.1
/* Breakpoints */
/* ------------------------- Source: http://blog.scur.pl/2012/06/variable-media-queries-less-css/ */
@highdensity: ~"only screen and (-webkit-min-device-pixel-ratio: 1.5)",
~"only screen and (min--moz-device-pixel-ratio: 1.5)",
~"only screen and (-o-min-device-pixel-ratio: 3/2)",
~"only screen and (min-device-pixel-ratio: 1.5)";
@mobile: ~"only screen and (max-width: 529px)";
@tablet: ~"only screen and (min-width: 530px) and (max-width: 949px)";
@desktop: ~"only screen and (min-width: 950px) and (max-width: 1128px)";
@desktop-xl: ~"only screen and (min-width: 1129px)";