Skip to content

Instantly share code, notes, and snippets.

@markjames
markjames / gist:372194
Created April 20, 2010 08:34
Clearfix
/* @group Clearfix */
{YOUR SELECTOR}:after {
visibility: hidden;
display: block;
font-size: 0;
content: " ";
clear: both;
height: 0;
} /* Clearfix */
* html {YOUR SELECTOR} { zoom: 1; display: block; } /* Clearfix - IE6 */
<?php
require( 'persistent.class.php' );
class Episode extends Persistent {
public $series;
public $season;
public $number;
public $airdate;
<?php
ob_start();
$out = fopen('php://output', 'w');
$headerRow = array();
foreach( array_keys($result[0]) as $fieldname ) {
$headerRow []= isset($fields[$fieldname]) ? $fields[$fieldname]['title'] : $fieldname;
}
fputcsv($out, $headerRow );
foreach( $result as $row ) {
<?php
// Demo for session fixation
//
// Attacker creates a session by visiting the page: http://famfamfam.com/sessionfixation.php
// Attacker gets their session ID out of the cookie (or in this case from the page)
// Attacker creates a URL such as http://famfamfam.com/sessionfixation.php?PHPSESSID=attackerssessionid and sends it to victim
// Victim clicks the URL (now both the attacker and victim are using the same session)
// Victim logs in
// Now the attacker is logged in to the victim's account too (same session!)
In /etc/hosts:
127.0.0.1 test.site
In your httpd.conf:
NameVirtualHost *
<VirtualHost *>
ServerName test.site
@markjames
markjames / Database.php
Created December 9, 2010 17:12
Database class
<?php
/**
* Database class
*
* @author Mark James
* @package
*/
/**
<script src="https://github.com/ImDom/BeaconPush-PHP/blob/master/jquery.beaconpush.js"></script>
<script>
Beacon.connect('AAAAAAA', ['channelname'], {log:false});
$.BeaconPush.addEventListener('update', function(event) {
setData( event.data );
});
</script>
@markjames
markjames / gist:1050886
Created June 28, 2011 10:40
Units/Groups
<style>
/*
The .unit class indicates a single page item (e.g. a latest news list). Units cannot be nested.
The .group class indicates a collection of units.
*/
.unit:before, .unit:after, .group:before, .group:after { content: "\0020"; display: block; height: 0; overflow: hidden; }
.unit:after, .group:after { clear: both; }
.unit, .group { zoom: 1; }
@markjames
markjames / gist:1180463
Created August 30, 2011 08:34
prompt customisation
function parse_git_branch_and_add_brackets {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\ \[\1\]/'
}
PS1="\[\033[0;37m\]\h:\u\[\033[0m\] \W\[\033[0;32m\]\$(parse_git_branch_and_add_brackets) \[\033[0m\]\$ "
@markjames
markjames / git.sh
Created September 1, 2011 10:04
Going git
# The following commands
# need to be run once to set-up git
# Install git (you may have this already, type git then hit [ENTER] in Terminal to check)
cd ~/Downloads && curl -OL "http://git-osx-installer.googlecode.com/files/git-1.7.6-x86_64-snow-leopard.dmg" && open ~/Downloads/git-1.7.6-x86_64-snow-leopard.dmg
# Start a new Terminal window
# I don't have a command for this one
# Install the Git Flow extension