This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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!) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
BOLD="\033[1m" | |
_BOLD="\033[22m" | |
RED="\033[31m" | |
YELLOW="\033[33m" | |
GREEN="\033[32m" | |
RESET="\033[39m" | |
range=$1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
DATEDIFF(@oldDate,a.DisplayDate) AS 'Date Difference', | |
(@oldDate:=a.DisplayDate) as 'DisplayDate' | |
FROM | |
NewsPost a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// ... | |
function augmentSQL(SQLQuery &$query) { | |
// Get the content at a specific date | |
if($date = Versioned::current_archived_date()) { | |
foreach($query->from as $table => $dummy) { | |
if(!isset($baseTable)) { | |
$baseTable = $table; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Browsermob Script | |
// This test emulates a single user visiting the homepage, | |
// and downloading any necessary assets | |
var httpSiteRoot = 'http://mydomain.cat/'; | |
var assetRoot = 'http://mydomain.cat/static/'; | |
var uploadRoot = 'https://s3-eu-west-1.amazonaws.com/mydomain.cat/'; | |
// ============================================== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class ExtsViewableDataDecorator extends Extension { | |
/** | |
* Adds first/last/start/end class to a list item. | |
* | |
* Sometimes you need to: | |
* Lay out a load of thumbnails in a grid. | |
* Style only the first or last elements in a vertical/horizontal list of items |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// A new page type | |
class Page extends SiteTree { | |
static $icon = array('/site/icons/page.png?','file'); | |
// Or if you have icons in multiple states: | |
// static $icon = '/site/icons/page'; | |
// Allowed child types |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#SalesList .FrontItem:before, #SalesList .FrontItem:after { content: "\0020"; display: block; height: 0; overflow: hidden; } | |
#SalesList .FrontItem:after { clear: both; } | |
#SalesList .FrontItem { zoom: 1; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
NewerOlder