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
function replace { | |
echo Replacing '"'$1'"' with '"'$2'"' | |
find . \( -path './framework' -o -path './cms' -o -path './.git' \) -prune -o -name '*.php' -exec grep -l "$1" {} \; | xargs sed -i "" 's/'"$1"'/'"$2"'/g' | |
} | |
replace 'Director::currentPage(' 'Director::get_current_page(' | |
replace 'Member::currentMember(' 'Member::currentUser(' | |
replace 'new DataObjectSet' 'new ArrayList' |
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
/** | |
* | |
* Requires these 'thirdparty' packages | |
* go get github.com/moovweb/gokogiri | |
*/ | |
package main | |
import ( | |
"fmt" | |
"github.com/moovweb/gokogiri" |
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
package main | |
import "fmt" | |
func main() { | |
list := []int{1, 8, 10, 23, 3, -1, 2, 2, 6, 3, 4} | |
fmt.Println(list) | |
bubbleSort(list) | |
fmt.Println(list) | |
} |
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 | |
/* | |
Ideas on ORM interface and interactions / relationships | |
*/ | |
class Dataobject { | |
function __construct(Data $mapper, array $data = null) { | |
$this->mapper = $mapper; | |
if($data) { |
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 | |
# | |
# ss-upgrader.sh | |
# | |
# INTRODUCTION | |
# | |
# There are some threads on the SS forums that describe the techdocs for upgrading a 2.4 site to 3.x as being too technical. Mainly from content authors who | |
# also happen to be site maintainers - they are not coders. | |
# The aim of this script is to therefore to automate - in as much as this is possible in a user-configured, open-source software project - to help those new to | |
# SS3 upgrade from 2.x as smoothly as possible. |
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 | |
/** | |
* CustomHierarchy | |
* | |
* This hierarchy overrides the getChildrenAsUL to not cascade into every child, this makes the sitetree loading a bit | |
* snappier | |
*/ | |
class CustomHierarchy extends Hierarchy { | |
/** |
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 | |
$ftpConnection = array( | |
'host' => 'server.co.nz', | |
'username' => 'username', | |
'password' => 'secret-password' | |
); | |
// set up basic connection | |
$connection = ftp_connect($ftpConnection['host']); |
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 | |
$host = 'ldap://localhost'; | |
$username = 'DOMAIN\\username'; | |
$password = 'password'; | |
$dn = "OU=Users,DC=company,DC=co,DC=nz"; | |
if(!$argv[1]) { | |
$searchFilter = '(employeeID=*)'; | |
} else { | |
$searchFilter = '(employeeID='.$argv[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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>ANSIBlackColor</key> | |
<data> | |
YnBsaXN0MDDUAQIDBAUGFRZYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS | |
AAGGoKMHCA9VJG51bGzTCQoLDA0OVU5TUkdCXE5TQ29sb3JTcGFjZVYkY2xhc3NGMCAw | |
IDAAEAGAAtIQERITWiRjbGFzc25hbWVYJGNsYXNzZXNXTlNDb2xvcqISFFhOU09iamVj | |
dF8QD05TS2V5ZWRBcmNoaXZlctEXGFRyb290gAEIERojLTI3O0FITltiaWttcn2GjpGa |
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 | |
$sorrows = array(); | |
for($days=1;$idx<$days;$days++) { $sorrows[$days] = 'joy' }; | |
foreach($sorrows as $feelings) { | |
echo mktime(10, 42, 0, 1, 29, 2012).' '.$feelings.PHP_EOL; | |
} |