Skip to content

Instantly share code, notes, and snippets.

@wookiecooking
wookiecooking / chromepatch.php
Created July 23, 2015 16:42
WordPress Chrome Fix
<?php
/*
Plugin Name: Chrome 44 SSL Fix
Description: Fixes the problem when Chrome v.44 forces SSL on WordPress Sites. Remove the plugin when Chrome v.45 is out on 07.27.2015
Version: 1.0
*/
// Prevent direct access to the file
if ( ! defined( 'ABSPATH' ) ) exit;
#!/bin/bash
username='someusername'
password='somepassword'
database='somedatabase'
host='somehost'
for x in `mysql --skip-column-names -u $username -p$password $database -h $host -e 'show tables;'`; do
mysqldump -u [username] -p[password] [db name] $x > "$x.sql"
sleep 30
done
@wookiecooking
wookiecooking / example.php
Created April 17, 2015 23:36
Simple email class
<?
include 'mailer.php';
$mailer = new Mail();
$mailer->sendto('someadmin@admin.com');
$mailer->returner('someadmin1@admin.com');
$mailer->subject('My website!');
//$mailer->body(array("size" => "XL", "color" => "gold"));
$mailer->body('Really some content!');
$mailer->send();
<?php
/**
* Closest to Zero
*
* Write a function that can take an array of floating integers and return the integer that is closest to zero.
* Consider the following requirements:
* If the array is empty, then return 0 (zero)
* If two numbers are as close to zero, consider the positive integer as the closer to zero (e.g. if the
* array contains both -5 and 5, then the function returns 5).
@wookiecooking
wookiecooking / hosx.sh
Last active January 21, 2020 23:44
Simple Installation of the latest Brew, Cask, Git, Node.js, and atom editor.
#!/bin/bash
<<COMMENT
# Simple Installation of the latest Brew, Cask, Git, Node.js, and atom editor. #
@Author: Austin Turnage
@License: MIT
# Example Usage #
Download Method::
Download this file, and from the directory, run in terminal
@wookiecooking
wookiecooking / oldies.txt
Created March 27, 2015 00:47
Bitchin list
Beethoven - Symphony No. 7, 4th Movement: Allegro Con Brio
Beethoven - Egmont Overture
Beethoven - Für Elise
Beethoven - Sonata No. 14 "Moonlight", 1st Movement.
Beethoven - Sonata No. 14, 3rd Movement.
Beethoven - Sonata No. 23 "Appassionata", 1st Movement.
Beethoven - Symphony No. 1, Finale
Beethoven - Symphony No. 5, 1st Movement.
Beethoven - Symphony No. 6 "Pastoral", 1st Movement.
Beethoven - Symphony No. 9, 4th Movement.
@wookiecooking
wookiecooking / cptTemplates.php
Created March 26, 2015 17:12
template selection in custom post types in wordpress
<?php
function cptTemplateMetaBox() {
$post_types = get_post_types();
foreach ( $post_types as $post_type ) {
add_meta_box( 'cpt-template-meta-box', 'Template', 'cptTemplateMetaBoxMarkup', $post_type, 'side', 'high' );
}
}
add_action( 'add_meta_boxes', 'cptTemplateMetaBox' );
@wookiecooking
wookiecooking / Prime.js
Created March 20, 2015 18:42
Random Generator
var Arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0];
var AArr = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'];
var i = 0;
var Dump = [];
function isPrime(n) {
// If n is less than 2 or not an integer then by definition cannot be prime.
function fibonacci(n) {
let previous = 0;
let current = 1;
for(let i = 0; i < n; i += 1) { // Implicit block scope for the loop header
let temp = previous;
previous = current;
current = temp + current;
}
@wookiecooking
wookiecooking / chat.js
Created March 20, 2015 18:13
Example Chat Server
var net = require("net");
var sys = require("sys");
var EventEmitter = require("events").EventEmitter;
/*******************************************************************************
* ChatServer
*
* Manages connections, users, and chat messages.
******************************************************************************/