Skip to content

Instantly share code, notes, and snippets.

View joshtronic's full-sized avatar
🐢
🐢 🐢 🐢

Josh Sherman joshtronic

🐢
🐢 🐢 🐢
View GitHub Profile
@joshtronic
joshtronic / 0_reuse_code.js
Created August 14, 2014 13:27
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@joshtronic
joshtronic / Gruntfile.js
Last active August 29, 2015 14:06
PHP to HTML to PDF, BOOM!
// http://downloads.sourceforge.net/project/wkhtmltopdf/0.12.1/wkhtmltox-0.12.1_osx-carbon-i386.pkg
// Requires a hacked grunt-wkhtmltopdf/tasks/wkhtmltopdf.js file (attached to this gist)
module.exports = function(grunt)
{
grunt.initConfig(
{
shell: {
php2html: {
@joshtronic
joshtronic / gulpfile.js
Created September 10, 2014 12:45
STREET Gulpfile
var gulp = require('gulp');
var insert = require('gulp-insert');
var less = require('gulp-less');
var minify = require('gulp-minify-css');
var rename = require('gulp-rename');
var tap = require('gulp-tap');
var watch = require('gulp-watch');
var lazy = require('lazypipe');
// Creates the desktop / unresponsive stylesheet
@joshtronic
joshtronic / gist:6766d21dc2a12984dbb3
Last active August 29, 2015 14:06
that internationalization life
<?php
class i18n
{
private static $strings = [
'WELCOME' => [
'en' => 'Welcome',
'es' => 'Bienvenidos',
],
];
<?php
class v1_user extends \Pickles\Resource
{
/**
* Has to be broken out by request method as to not cause fall out. The other
* option could be to grab all of the method names, loop through and look for
* the largest revision number (if the revision is not specified and _METHOD()
* doesn't exist
**/
@joshtronic
joshtronic / replicate.js
Last active August 29, 2015 14:10
self replicating node script
function replicate() {
tick = String.fromCharCode(39),
lines = [
'function replicate() {',
' tick = String.fromCharCode(39),',
'',
' lines = [',
' ];',
'',
<?php
if (isset($_GET['secret']) && $_GET['secret'] == 'some-secret-key') {
// @todo integrate a sanity check against this:
// https://help.github.com/articles/what-ip-addresses-does-github-use-that-i-should-whitelist/
`git pull`;
}
@joshtronic
joshtronic / gist:3b3acc1f91a32d90a666
Created July 16, 2015 22:18
systems involved in wordpress pingback ddos attack on 2015-07-15
pkts bytes target prot opt in out source destination
2535 152K DROP all -- any any ec2-54-245-111-118.us-west-2.compute.amazonaws.com anywhere
11246 675K DROP all -- any any 200.ip-92-222-164.eu anywhere
810K 49M DROP all -- any any 191.ip-92-222-220.eu anywhere
109K 6553K DROP all -- any any 205.185.117.237 anywhere
113K 6759K DROP all -- any any 167.88.116.167 anywhere
1419K 85M DROP all -- any any ns201578.ip-91-121-132.eu anywhere
1580K 95M DROP all -- any any 5.79.16.34 anywhere
11332 589K DROP all -- any any southwind.fr anywhere
35540 2132K DROP all -- any any ec2-176-34-126-157.eu-west-1.compute.amazonaws.com anywhere
/**
* Is Local
*
* Checks if the current site is hosted locally or not.
*
* @static
* @return boolean whether or not the site is hosted locally
*/
public static function isLocal()
{