Skip to content

Instantly share code, notes, and snippets.

View MikeRogers0's full-sized avatar
🚂

Mike Rogers MikeRogers0

🚂
View GitHub Profile
<html>
<head>
<title>Vogue</title>
<style type="text/css">
#social-logos {
overflow: hidden;
}
#social-logos a{
float: left;
@MikeRogers0
MikeRogers0 / awful_contact_us_controller.rb
Last active August 29, 2015 14:04
An example of a terrible approach to a contact form.
class ContactUsController < ApplicationController
def index
end
def send_enquiry
if contact_form_valid?
ContactUsMailer.send_enquiry(contact_form_params).deliver
return redirect_to action: :thank_you
end
render :index
@MikeRogers0
MikeRogers0 / my-php-site.conf
Created July 7, 2014 21:34
My NGINX conf for PHP sites
server {
listen 80;
server_name _;
root /vagrant/www;
index index.html index.htm index.php;
expires -1;
location / {
try_files $uri $uri/ /index.php?q=$uri&$args;
@MikeRogers0
MikeRogers0 / essential-brew.sh
Last active June 23, 2023 18:17
Extra functions I like to run after running https://gist.github.com/BenNunney/7219538
#!/usr/bin/env sh
#
# Things I normally install when I first install Homebrew / Homebrew cask
# Make sure you've install XCode commandline tools & accepted the terms and conditions before running this.
# Homebrew stuff
## A nice text editor (Will show how to configure in another post)
brew install vim
brew install macvim
#!/usr/bin/env sh
##
# Make your Mac feel like home...
# Shoutout to @dtsn for being generally awesome and getting me started.
#
# install it:
# curl -sL https://gist.github.com/BenNunney/7219538/raw/f9b933cca93b67dd63a2d8b1eeebb69e87dc9591/feels-like-home.sh | sh
#
@MikeRogers0
MikeRogers0 / scopes.php
Last active November 19, 2018 01:25 — forked from tomoakley/PHP Variable Scope with Wordpress shortcode attributes
PHP Variable Scope with Wordpress shortcode attributes
<?php
// I have a function, embedVine(), which is a Wordpress shortcode. It uses one attribute, $id which I've assigned to $vine_id to avoid confusion ($post_id etc). This shortcode takes the ID (Vine IDs are the ending of the Vine URL, e.g http://vine.co/v/hx9LlrZxdqV, the id = hx9LlrZxdqV) and embed's the Vine within a Wordpress post. The shortcode markup is [vine id='...'].
$vine_id = false;
global $vine_id;
function embedVine($atts) {
global $vine_id;
extract(shortcode_atts(array(
"id" => ''
@MikeRogers0
MikeRogers0 / uptime-monitor.sh
Last active January 30, 2024 08:52
Uptime monitoring geeklet script
#!/usr/bin/php
<?php
# Array of the servers you want to ping.
$servers = array('mikerogers.io', 'google.com', 'downserver.come');
# PingDomain() from http://stackoverflow.com/a/9843251/445724
function pingDomain($domain){
$start_time = microtime(true);
$file = @fsockopen ($domain, 80, $errno, $errstr, 10);
$end_time = microtime(true);
chrome.browserAction.onClicked.addListener(function(tab) {
alert('Oh hey there! You checky clicker!');
chrome.tabs.executeScript(tab.id, {code: 'alert("I just came from the page!")'});
chrome.tabs.executeScript(tab.id, {file: 'some_file.js'});
})
@MikeRogers0
MikeRogers0 / mikes_bot.rb
Created September 3, 2013 19:31
RTanque Robot I wrote
class MikesBot < RTanque::Bot::Brain
NAME = 'Mikes Bot'
include RTanque::Bot::BrainHelper
TURRET_FIRE_RANGE = RTanque::Heading::ONE_DEGREE * 5.0
def tick!
## main logic goes here
def tick!
@MikeRogers0
MikeRogers0 / .gitignore
Created September 1, 2013 19:59
How to setup a global .gitignore
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #