Skip to content

Instantly share code, notes, and snippets.

View chardcastle's full-sized avatar

Chris Hardcastle chardcastle

  • London (England)
View GitHub Profile
@chardcastle
chardcastle / Kohana cron.php
Created May 17, 2010 22:44
My cron file for kohana 2.3.4
<?php
/**
* Created by Chris Hardcastle to run cron jobs
* Based on the default kohana 2.3.4 index.php
* Note the required #! stated above
* CRON TAB USAGE (To run twice a day)
0 0,12 * * * /usr/bin/php [root][site]/cron.php --controller --method
*
* Use the shebang --> #!/usr/bin/php (should you need it, thanks @spolster)
*/
@chardcastle
chardcastle / toggle-selected-link-in-pagination.js
Created May 18, 2010 22:57
Toggle selected link in pagination - JQuery
@chardcastle
chardcastle / jQuery image pre-load
Created July 5, 2010 22:26
Image preloading in JQuery
/*
* Written by Chris Hardcastle
* Pre-load an image using jQuery
* Example HTML layout
<div id="globalInner">
<div id="loading"><!-- css loading gif --></div>
<div id="stage"></div>
</div>
*/
/*
@chardcastle
chardcastle / move-files-into-folder.bash
Created July 31, 2010 20:07
Move files on condition - linux line command
find ./ -name "*.css" -print0 | xargs -0 -I xxx mv xxx css/
@chardcastle
chardcastle / couchdb_reader.html
Created December 6, 2010 23:15
Uses JQuery and a little HTML to run records from a CouchDB instance like a slide show.
<!Doctype html>
<html>
<head>
<script type="text/javascript" src="http://google.com/jsapi"></script>
<script type="text/javascript">
google.load('jquery','1.3.2')
</script>
</head>
<style type="text/css">
#thumb{
@chardcastle
chardcastle / blank.html
Created March 16, 2011 22:43
HTML file template
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Site name</title>
</head>
<body></body>
</html>
@chardcastle
chardcastle / gist:884987
Created March 24, 2011 12:40
Recover deleted files
// from http://thefinerstuff.posterous.com/git-saved-my-day-restore-accid
git ls-files -d | xargs git checkout --
@chardcastle
chardcastle / read-xml.cs
Created March 28, 2011 14:12
File an xml file locally off disk
/*
* Read the Homepage XML file and get the snippets
* from file
*/
public List<string> get_homepage_snippets()
{
List<string> snippets = new List<string>();
XmlTextReader reader = new XmlTextReader(Server.MapPath("~/Data/homepage.xml"));
while (reader.Read())
@chardcastle
chardcastle / ff_fix_button.css
Created May 25, 2011 13:45
Fix firefox two pixel button
@-moz-document url-prefix() {
#frm_contact_submit {
padding: 0 0 2px 8px !important;
}
}
@chardcastle
chardcastle / deploy-static.ps1
Created June 1, 2011 22:48
Upload files (recursive) via powershell
## Automate FTP uploads
## Go to destination
cd C:\Test
$location = Get-Location
"We are here: $location"
## Get files
$files = Get-ChildItem -recurse
## Get ftp object
$ftp_client = New-Object System.Net.WebClient
$ftp_address = "ftp://user:pass@adress:/home/chardcastle/test"