Skip to content

Instantly share code, notes, and snippets.

View rustyeddy's full-sized avatar
💭
Hacking

Rusty Eddy rustyeddy

💭
Hacking
View GitHub Profile
@rustyeddy
rustyeddy / ruler.go
Created May 21, 2018 20:59
Ruler Comment ~ Double Slashes
// 1 2 3 4 5 6 7 8 9
// 3456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
@rustyeddy
rustyeddy / loggerNoTimestamps.go
Created March 7, 2018 20:30
Go - Turn off logger timestamps
func getLoggerNoTimestamps() Logger {
return log.New(os.Stderr, "", 0)
}
@rustyeddy
rustyeddy / lambda-shellscript.py
Last active September 22, 2017 00:55
AWS Lambda - running a bashscript from python
import logging
import subprocess
def lambda_handler(event, context):
# Probably get the script name from an environment variable or event...
script = "bashscript.sh"
log = logging.getLogger("lambda-logger")
log.setLevel(logging.INFO)
@rustyeddy
rustyeddy / mininet-simple.py
Last active March 14, 2016 22:30
Mininet simple 3 switch
#!/usr/bin/python
from mininet.topo import Topo
from mininet.net import Mininet
from mininet.node import Controller, RemoteController
from mininet.cli import CLI
from mininet.log import setLogLevel
class SimpleTopo(Topo):
@rustyeddy
rustyeddy / genesis-footer-credits.php
Last active August 29, 2015 14:14
Modify the footer credits on a Genesis Child Theme
@rustyeddy
rustyeddy / contact-form-7-redirect.js
Created February 2, 2015 19:24
Contact Form 7 - Redirect to a different thank you page based on input from from a pull down select form field.
/**
* Contact form 7 - Redirect to a specific page based on the value of a form
* field. In this specific example I created a drop down menu item and gave
* it an id of 'select-menu', I also created .
*/
function cf7_redirect() {
// Set the base url for contact-form-7
var url = document.referrer;
@rustyeddy
rustyeddy / success-failure-handlers.html
Created February 1, 2015 19:52
Success and failure handlers for Google Apps Web Apps. Place this in HTML for Google Apps HTML service.
<script>
function onSuccess(numUnread) {
alert('You have ' + numUnread + ' messages');
}
function onFailure(error) {
alert(error.message);
}
@rustyeddy
rustyeddy / animations.scss
Last active August 29, 2015 14:14
Animation Gists see Animate.css for some really cool stuff.
@mixin zoomInDown( $args )
{
-webkit-animation: zoomInDown $args;
-moz-animation: zoomInDown $args;
animation: zoomInDown $args;
}
@mixin zoomOutDown( $args )
{
-webkit-animation: zoomOutDown $args;
@rustyeddy
rustyeddy / wp_query_variables.php
Last active August 29, 2015 14:13
Properly Handling URL requests in WordPress
/*
* We need to add our query variables
*/
add_filter( 'query_vars', 'mb_register_variables' );
function mb_register_variables( $qv )
{
$qv[] = 'Badge';
$qv[] = 'Username';
$qv[] = 'Password';
return $qv;
@rustyeddy
rustyeddy / genesis-entry-title-banner.php
Last active August 29, 2015 14:04
Genesis Entry Title Banner
<?php
/**
* This section of code will remove the entry title header from
* the entry itself and place it just below the header with a solid
* background of a different color to give it a stand out effect.
*/
add_action( 'genesis_after_header', 'gs_do_entry_title' );
function gs_do_entry_title()
{