Skip to content

Instantly share code, notes, and snippets.

View mattrayner's full-sized avatar
:octocat:
Tinkering

Matt Rayner mattrayner

:octocat:
Tinkering
View GitHub Profile
@mattrayner
mattrayner / CSS Buttons
Last active January 4, 2016 03:28
Simple CSS buttons with gradients, shadows and transitions. Includes multiple themes and variations all based off of one master class
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>CSS Buttons</title>
<style>
/* MAIN BUTTON STYLES */
.button {
display: inline-block;
margin: 0;
@mattrayner
mattrayner / .bash_rc
Last active August 29, 2015 14:08
Easy Test Reporter
# Add the below to your ~/.bashrc file (with the path changed) and then run 'source ~/.bashrc' to enable the command
# Launch Easy Tester with '$ et'
easy_tester() {
source /path/to/easy_tester.sh
}
alian et=easy_tester()
# Custom SSO logger
require 'singleton'
class SSOLogger < Logger
include Singleton
def initialize
super(Rails.root.join('log/sso.log'))
self.formatter = formatter()
self
end
@mattrayner
mattrayner / sample-dashing-layout.haml
Created March 25, 2015 10:43
A sample working haml layout for dashing
- content_for :title do
My super sweet dashboard
.gridster
%ul
%li{"data-col" => "1", "data-row" => "1", "data-sizex" => "1", "data-sizey" => "1"}
%div{"data-id" => "status", "data-moreinfo" => "Protip: You can drag the widgets around!", "data-text" => "", "data-title" => "Uniprix-Printemps", "data-view" => "Text"}
%li{"data-col" => "1", "data-row" => "1", "data-sizex" => "1", "data-sizey" => "1"}
%div{"data-id" => "participant_count", "data-title" => "Participants", "data-view" => "Number"}
%li{"data-col" => "1", "data-row" => "1", "data-sizex" => "1", "data-sizey" => "1"}
@mattrayner
mattrayner / date_range_formatter.rb
Created April 8, 2015 09:05
Date Range Formatter Test
# Format a single date instance with an optional time
#
# @author Matt Rayner
# @since 1.0.0
#
# @attr [Date] Date The date that we are formatting
# @attr [String] Time An optional time value for this date
class DateFormatter
attr_reader :date, :time
@mattrayner
mattrayner / Setup Mamo Redirect.bat
Created May 12, 2015 10:34
MAMP redirect on Windows
@echo off
echo Creating a local redirect
echo =============================
SET /P IP=HOST IP: %=%
echo =============================
SET /P URL=URL: %=%
echo =============================
echo Adding to hosts file:
echo.
echo %IP% %URL%
@mattrayner
mattrayner / local_rails.sh
Created December 4, 2015 11:09
Open a local rails development server, binding it to your LAN IP and a port of your choice (or 3000) to allow easy sharing within teams or for mobile deice testing
#!/bin/bash
echo ==========================
echo Local Rails Launcher
echo ----
echo
echo Getting local IP Address
echo --------------------------
echo
@mattrayner
mattrayner / README.md
Last active October 6, 2021 12:44
API Example

Within Classes>AppDeligate.m scroll to the bottom and remove the references to Portrait and UpsideDown. It sould look like this when finished:

- (NSUInteger)application:(UIApplication*)application supportedInterfaceOrientationsForWindow:(UIWindow*)window
{
    // iPhone doesn't support upside down by default, while the iPad does.  Override to allow all orientations always, and let the root view controller decide what's allowed (the supported orientations mask gets intersected).
    NSUInteger supportedInterfaceOrientations = (1 << UIInterfaceOrientationLandscapeLeft) | (1 << UIInterfaceOrientationLandscapeRight);

    return supportedInterfaceOrientations;
}
@mattrayner
mattrayner / ReportAdminExtension.php
Last active June 9, 2016 15:03
SilverStripe custom admin base url fix for ReportAdmin
<?php
class ReportAdminExtension extends Extension {
public function updateEditForm($form) {
$gridField = $form->Fields()->dataFieldByName('Reports');
if ($gridField instanceof GridField) {
$columns = $gridField->getConfig()->getComponentByType('GridFieldDataColumns');
$columns->setFieldFormatting(array(