Skip to content

Instantly share code, notes, and snippets.

@egrouse
egrouse / bash-prompt.sh
Last active August 29, 2018 10:56
git PS1 for bash
#!/bin/bash
set_prompt()
{
local last_cmd=$?
local txtreset='$(tput sgr0)'
local txtbold='$(tput bold)'
local txtblack='$(tput setaf 0)'
local txtred='$(tput setaf 1)'
local txtgreen='$(tput setaf 2)'
<pre>
<?php
function buildBaseString($baseURI, $method, $params) {
$r = array();
ksort($params);
print_r( $params );
foreach($params as $key=>$value){
$r[] = "$key=" . rawurlencode($value);
}
return $method."&" . rawurlencode($baseURI) . '&' . rawurlencode(implode('&', $r));
@egrouse
egrouse / gist:3040051
Created July 3, 2012 14:29
WordPress meta issues
// Custom meta boxes for the homepage signs
add_action( 'add_meta_boxes', 'r6_add_sign_box' ); // Create meta box action
add_action( 'save_post', 'r6_save_postdata' ); // Save data for meta box
function r6_add_sign_box()
{
add_meta_box(
'r6_sign_meta',
'Homepage Signs',
'r6_draw_sign_box',
@egrouse
egrouse / ch3q7-main.m
Created May 15, 2012 14:10
Completed exercises from 'Programming in Objective-C' - because why not?
//
// main.m
// ch3q7
//
// Created by Ellis Grouse on 15/05/2012.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
// Book exercise: Chapter 3 Q7
// Make a class called XYPoint that holds 2 coordinates x,y and can set/get them separately
// Write functionality to output the information
//
$padding: 24px;
html { font-family: "Museo Sans", "Verdana", sans-serif; font-size: 62.5%; height: 100%; overflow-y: scroll; }
body { font-size: 1.2em; line-height: $padding; color: #444;
h1 { border-bottom: 1px solid #ddd; padding-bottom: $padding/4; margin-bottom: $padding/2; }
}
b, strong { color: #000; font-weight: bold; }
h1 { font-size: 1.5em; padding-bottom: $padding/2; }
<!DOCTYPE HTML>
<html lang="en-US">
<head>
[[$htmlhead]]
</head>
<body>
<section id="wrapper">
[[$sidebar]]
<section id="main">
<article class="post" id="post-[[*id]]">
@egrouse
egrouse / URL string
Created April 1, 2012 19:59
Sending Google Reader posts to OmniFocus for Mac
http://egrouse.com/tool/grof.php?t=${title}&u=${url}&s=${source}
%section#unit-settings
%h1
= "Editing Unit: #{@unit.name}"
%a{ :href => '#', :class => 'toggle-box', :rel => 'unit-settings' } Hide
.box
= form_for @unit, :url => edit_unit_path( @unit ), :html => { :multipart => true } do |f|
.field
= f.label :name
= f.text_field :name
.field
@egrouse
egrouse / gist:2045890
Created March 15, 2012 18:32
jquery is cool
$(document).ready( function(){
// Do the hidy boxes
$('a.toggle-box').click( function(){
var rel = $(this).attr( 'rel' ),
section = $( 'section#' + rel ),
target = section.find( '.box' );
if( section.hasClass( 'hidden' ) )
{
@egrouse
egrouse / Search String - Mac (no .exe)
Created February 14, 2012 11:04
A better MysterBin Chrome search
http://www.mysterbin.com/advsearch?q=-.exe+%s&match=normal&minSize=1&maxSize=max&group=&maxAge=1269&nopasswd=on&complete=0