Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working with the amazing team at Landing. #liveeverywhere

Sterling Hamilton grok

🏠
Working with the amazing team at Landing. #liveeverywhere
View GitHub Profile
View originalsin.js
jQuery(function() {
var bootstrap = [
'affix',
'alert',
'button',
'carousel',
'collapse',
'dropdown',
'modal',
'popover',
@grok
grok / functions.php
Last active Aug 29, 2015
Encountering what appears to be a core bug with the core WordPress Walker_Nav_Menu being extended within PHP 5.4.24 WordPress V3.8.2
View functions.php
<?php
class My_Walker extends Walker_Nav_Menu {
}
?>
View pass-vars-to-action.php
Warning: call_user_func_array() expects parameter 1 to be a valid callback, array must have exactly two members in /wp-includes/plugin.php on line 429
@grok
grok / nest.php
Last active Aug 29, 2015
This is an example of properly using nested functions within PHP, as well as the improper way. It outlines that improper use throws the function into the global scope. In general I would recommend not using nested functions. It dirties things up.
View nest.php
<?php
class Example {
// This is not intended to be accessible outside this class.
private function _hidden() {
// This is not acceptable. This becomes global.
// also unable to declare this as private vs. public - it generates a parse error.
function _shouldbehidden() {
@grok
grok / script.php
Created Apr 28, 2014
Another server scanner I wrote back in the day.
View script.php
Example Output:
Retrieving Joomla Site List…
Detecting Joomla Versions…
[http://www.angelkissfoundation.org] -> [Joomla!] [1.0.15] -> [No VirtueMart Detected]
[http://www.florinanalytical.com] -> [Joomla!] [1.0.13] -> [No VirtueMart Detected]
[http://www.kcareno.com] -> [Joomla!] [1.0.13] -> [No VirtueMart Detected]
[http://www.itosbolivia.com] -> [Joomla!] [1.0.13] -> [No VirtueMart Detected]
[http://www.successdna.com] -> [Joomla!] [1.0.13] -> [VirtueMart] [1.0.13a.]
[http://www.computercorps.org] -> [Joomla!] [1.0.15] -> [No VirtueMart Detected]
@grok
grok / script.sh
Created Apr 28, 2014
Old legacy script I wrote for maintaining servers.
View script.sh
#!/bin/bash
# In an effort to automate some of my daily tasks I decided to write this mail quota monitoring script. It gets all quota information, processes it, then Twitters the information AND sends an e-mail. The Twitter information is vague so security isn’t compromised, but the e-mail has the details. This way I can get a heads up of impending doom on certain mail accounts!
# Get the e-mail ready.
Email="esupport@exyst.com";
Subject="Xync: Account(s) Exceeding Quota(s)."
Message="/tmp/message.txt"
# This starts the message fresh.
echo "Summary:" > $Message
@grok
grok / server-scanner.sh
Created Apr 28, 2014
This script found all sites using certain CMS platforms on a server I used to manage. This is for historical purposes. Really old code I wrote. I don't want to get rid of it because it reminds me of a time long long ago when I broke more then I fixed without realizing it :)
View server-scanner.sh
#!/bin/bash
Colors() {
Escape="\033";
BlackF="${Escape}[30m"; RedF="${Escape}[31m"; GreenF="${Escape}[32m";
YellowF="${Escape}[33m"; BlueF="${Escape}[34m"; PurpleF="${Escape}[35m";
CyanF="${Escape}[36m"; WhiteF="${Escape}[37m";
BlackB="${Escape}[40m"; RedB="${Escape}[41m"; GreenB="${Escape}[42m";
@grok
grok / git-update.sh
Created Apr 28, 2014
This was an old script I wrote, I later converted to ruby: https://github.com/grok/script-update-repositories
View git-update.sh
#!/bin/bash
# This is where I want my script to start.
cd ~/Projects/
# Let the person running the script know what's going on.
echo -e "\n\033[1mPulling in latest changes for all repositories...\033[0m\n"
# Find all directories here - that are at least 1 level down, but don't go any further than 1 directory.
# Go into those directories and pull the repository.
@grok
grok / script.php
Created Apr 28, 2014
Little server scanner to help maintain a server I used to work on years ago. This is purely for historical sake.
View script.php
Example Output:
Retrieving Site List…
[http://www.breweryarts.org] [Mambo] [4.5.4]
[http://www.artbyblair.com] [Mambo] [4.5.4]
[http://www.budgaugh.com] [Joomla!] [1.0.13]
[http://www.ecomadness.com] [Joomla!] [1.0.15]
[http://www.janusstudio.com] [Joomla!] [1.0.11]
[http://www.sharonchandler.com] [Mambo] [4.5.4]
@grok
grok / output
Created Apr 28, 2014
This was another script I wrote to maintain servers long ago. Once again, this is for historical sake.
View output
Example Output:
This is an automated message.
Below is a list of all PHPList e-mails that went out for September
[5040] E-mails for Database: [ahhhmassage_db]
[24103] E-mails for Database: [clarkcountybar_newsletter]
[7978] E-mails for Database: [commacoffee_news]
[11665] E-mails for Database: [mckernan_newsletter]