Tag Archive for textmate

HTML5 TextMate Snippet

<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>${1:${TM_FILENAME/((.+)..*)?/(?2:$2:Page Title)/}}</title>
<link rel="stylesheet" type="text/css" media="screen" href="css/master.css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<!--[if IE]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
$0
</body>
</html>

source

jquery document ready

$(document).ready(function () {
// Code here
});

source

Accessible Forms CSS

form.cmxform fieldset,form#standardForm fieldset{margin-bottom:10px;border:1px solid #ccc;background:#f0f0f0;}
form.cmxform fieldset fieldset,form#standardForm fieldset fieldset{background:none;border:none;}
form.cmxform legend,form#standardForm legend{padding: 0 2px;font-weight:bold;}
form.cmxform label,form#standardForm label{display:inline-block;line-height:1.8;vertical-align:top;}
form.cmxform fieldset ol,form#standardForm fieldset ol{margin:0;padding:0;}
form.cmxform fieldset li,form#standardForm fieldset li{list-style:none;padding:5px 10px 7px;margin:0;}
form.cmxform em,form#standardForm em{font-weight:bold;font-style:normal;font-size:130%;color:#f00;}
form.cmxform label,form#standardForm label{width:120px; /* Width of labels */}
form.cmxform label.wider,form#standardForm label.wider{width:150px;}
form.cmxform textarea,form#standardForm textarea{font-size:100%;font-family:verdana;}
form.cmxform .autoSize,form#standardForm .autoSize{width:auto;border:none;}
form.cmxform input.submit,form#standardForm input.submit{cursor:pointer;border:1px solid #fff;background:#84b84a;color:#fff;font-size:110%;font-weight:bold;padding:3px;}
form.cmxform input.submit:focus,form#standardForm input.submit:focus{background:#84b84a;}
form.cmxform select,form#standardForm select{width:300px;}
form.cmxform input.widerInput,form#standardForm input.widerInput{width:300px;}

source

Jquery Accessible Forms Code

$(document).ready(
function()
{
if($.browser.mozilla)
{
$("form.cmxform").find("li > label").not(".nocmx").each(
function(i)
{
span = document.createElement("span");
$(span).css({ display: "block", width: $(this).css("width") });
$(this).css("display","-moz-inline-box");
$(span).html($(this).html());
$(this).html("");
$(this).append(span);
}
);
}
}
);

source

EE Contact Form

{if segment_2 =="thanks"}
<h1>Many thanks</h1>
<p>We have now received your message and will be in touch shortly.</p>
{if:else}
{exp:freeform:form form_name="contactForm" form_class="cmxform" form_id="standardForm" required="name|email|comments" notify="jim@sixmedia.net" template="contact_form" return="/contact/thanks/"}
<fieldset>
<legend>Your Contact Details</legend>
<ol>
<li>
<label for="name">Name: <em>*</em></label>
<input type="text" id="name" name="name" size="40" />
</li>

<li>
<label for="email">Your Email: <em>*</em></label>
<input type="text" id="email" name="email" size="40" maxlength="35" value="" />
</li>
</ol>
</fieldset>

<fieldset>
<legend>Comments</legend>
<ol>
<li>
<label for="subject">Subject:</label>
<input type="text" id="subject" name="subject" size="40" value="" />
</li>
<li>
<label for="comments">Message: <em>*</em></label>
<textarea id="comments" name="comments" rows="10" cols="60"></textarea>
</li>
{if captcha}
<li>
<label for="captcha">Enter the word you see in the image: <em>*</em></label>
<input type="text" id="captcha" name="captcha" value="" maxlength="20" /><br />
{captcha}
</li>
{/if}
</ol>
</fieldset>
<p><input name="submit" type="submit" value="Send Message" /></p>
{/exp:freeform:form}
{/if}

source

Add a directory to your PYTHONPATH in Terminal.app using TextMate

#open your .bash_profile by typing this into Terminal. You'll need to be in your home directory.

sudo mate edit .bash_profile

# Paste something like this into your .bash_profile

export PYTHONPATH=$HOME/Sites/dev:$PYTHONPATH

source

HTML5 Skeleton

<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title></title>
<link rel="stylesheet" type="text/css" media="screen" href="css/master.css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<!--[if IE]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>

</body>
</html>

source

Subversion export with PHP Script

//http://th.php.net/manual/en/function.svn-export.php

<?php
$working_dir     = '../';
$new_working_dir = '/home/user/devel/foo/trunk';

svn_export($working_dir, $new_working_dir);
?>

source

Simple SVN checkout using PHP

// <a href="http://www.fordnox.com/blog/2008/11/simple-svn-checkout-using-php/" >http://www.fordnox.com/blog/2008/11/simple-svn-checkout-using-php/</a>

$username = "username";
$password = "password";
$repository = "http://google-web-toolkit.googlecode.com/svn/trunk/";
$destination = ‘your/full/path’;

$checkout = "svn export –force –username $username –password $password $repository $destination";
$result = _exec($checkout);

function _exec($cmd)
{
if (substr(php_uname(), 0, 7) == "Windows") {
pclose(popen("start /B ". $cmd, "r"));
} else {
exec($cmd . " > /dev/null &");
}
}

source

Return http status codes

function getStatusCodeMessage($status){
// these could be stored in a .ini file and loaded
// via parse_ini_file()... however, this will suffice
// for an example
$codes = Array(
100  => 'Continue',
101  => 'Switching Protocols',
200  => 'OK',
201  => 'Created',
202  => 'Accepted',
203  => 'Non-Authoritative Information',
204  => 'No Content',
205  => 'Reset Content',
206  => 'Partial Content',
300  => 'Multiple Choices',
301  => 'Moved Permanently',
302  => 'Found',
303  => 'See Other',
304  => 'Not Modified',
305  => 'Use Proxy',
306  => '(Unused)',
307  => 'Temporary Redirect',
400  => 'Bad Request',
401  => 'Unauthorized',
402  => 'Payment Required',
403  => 'Forbidden',
404  => 'Not Found',
405  => 'Method Not Allowed',
406  => 'Not Acceptable',
407  => 'Proxy Authentication Required',
408  => 'Request Timeout',
409  => 'Conflict',
410  => 'Gone',
411  => 'Length Required',
412  => 'Precondition Failed',
413  => 'Request Entity Too Large',
414  => 'Request-URI Too Long',
415  => 'Unsupported Media Type',
416  => 'Requested Range Not Satisfiable',
417  => 'Expectation Failed',
500  => 'Internal Server Error',
501  => 'Not Implemented',
502  => 'Bad Gateway',
503  => 'Service Unavailable',
504  => 'Gateway Timeout',
505  => 'HTTP Version Not Supported'
);

return (isset($codes[$status])) ? $codes[$status] : '';
}

source