Skip to content

Instantly share code, notes, and snippets.

@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; }
<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 / Database.php
Created December 9, 2010 17:12
Database class
<?php
/**
* Database class
*
* @author Mark James
* @package
*/
/**
In /etc/hosts:
127.0.0.1 test.site
In your httpd.conf:
NameVirtualHost *
<VirtualHost *>
ServerName test.site
<?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!)
<?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
require( 'persistent.class.php' );
class Episode extends Persistent {
public $series;
public $season;
public $number;
public $airdate;
@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 */