Skip to content

Instantly share code, notes, and snippets.

View treffynnon's full-sized avatar
🧟

Simon Holywell treffynnon

🧟
View GitHub Profile
@treffynnon
treffynnon / jquery-ui-datepicker-in-dialogue.js
Created April 15, 2010 14:38
jQuery UI Datepicker in a Dialog
$('#dialogue').dialog({
modal: true,
open: function() {
$("#ui-datepicker-div").css("z-index", $(this).parents(".ui-dialog").css("z-index")+1);
}
});
@treffynnon
treffynnon / Method 2.php
Created February 4, 2010 15:19
Agavi: Form pre-population by ID
<?php
// With ID
$populate =& $this->getContext()->getRequest()->getAttribute('populate', 'org.agavi.filter.FormPopulationFilter');
$populate['form-id-1'] = new AgaviParameterHolder(array(
'question[0]' => 'Can you eat cheese?',
'answer[0]' => 'No'
));
$populate['form-id-2'] = new AgaviParameterHolder(array(
'question[0]' => "How many frags do I have to get before I'm considered awesome?",
@treffynnon
treffynnon / Method 1.php
Created February 4, 2010 15:19
Agavi: Form pre-population
<?php
// Like so
$this->getContext()->getRequest()->setAttribute('populate', new AgaviParameterHolder(array(
'question[0]' => 'Can you eat cheese?',
'answer[0]' => 'No'
)), 'org.agavi.filter.FormPopulationFilter');
// Or like so...
@treffynnon
treffynnon / jQuery Using and Manipulating Select Lists.js
Created February 4, 2010 15:19
jQuery: Using and Manipulating Select Lists
//Get the currently selected option's value
$(this).val();
//Get the currently selected option's title
$(this).text();
//Set the currently selected option to the supplied value
$(this).val('value');
//Get an option with a specified value
@treffynnon
treffynnon / iframeJQuery.js
Created February 4, 2010 15:19
jQuery: Accessing the contents of an iFrame
var iFrameBody = '';
$('#iframe').load(function(){
iFrameBody = $(this).contents().find('body');
});
@treffynnon
treffynnon / t-sql_dump.sql
Created February 4, 2010 15:19
T-SQL: Dump data command
sp_addumpdevice 'disk', 'pseudoName', 'C:yourFilename.mdb';
GO
DUMP DATABASE yourDatabaseName TO pseudoName;
GO
sp_dropdevice pseudoName;
@treffynnon
treffynnon / t-sql_import.php
Created February 4, 2010 15:19
T-SQL: Import into ODBC via PHP
<?php
/**
* Import a MS SQL T-SQL dump file into
* and ODBC connection via a PHP browser
* script.
*
* I have not tested the script with binary DB fields so
* I cannot confirm whether it works or not.
*
* @author Simon Holywell
@treffynnon
treffynnon / rewrite.xml
Created February 4, 2010 15:19
mod_rewrite: Default example
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
</IfModule>
@treffynnon
treffynnon / mass-virtual-hosting.xml
Created February 4, 2010 15:19
Apache2: Mass virtual hosting configuration
# Mass Virtual Hosting
UseCanonicalName Off
LogFormat "%V %h %l %u %t \"%r\" %s %b" vcommon
CustomLog /var/log/apache2/access.log vcommon
VirtualDocumentRoot /mnt/htdocs/%1
<Directory /mnt/htdocs/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
@treffynnon
treffynnon / cron3.bat
Created February 4, 2010 15:19
Windows: Scheduled tasks example
schtasks /Create /RU username /RP password /SC MINUTE /MO 2 /TN taskname /TR "C:\Program Files\wget\wget.exe --header=TASK_KEY:my-secret-key -U my-agent http://www.webaddress.com/script.php --spider"