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
[alias] | |
pu = !"git fetch origin -v; git fetch upstream -v; git merge upstream/master" | |
graph = log --graph --date-order -C -M --pretty=format:\"<%h> %ad [%an] %Cgreen%d%Creset %s\" --all --date=short | |
co = checkout | |
st = status | |
ci = commit | |
br = branch | |
unstage = reset HEAD -- | |
last = log -1 HEAD | |
[core] |
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 | |
session_destroy(); | |
// Start a new session with the token from the url, this will reinitialize the _SESSION | |
Session::start('wished-session-id'); | |
// Set the current session connected to the controller with an new instance with the proper _SESSION data | |
$session = new Session(isset($_SESSION) ? $_SESSION : null); | |
Controller::curr()->setSession($session); | |
// Some test that this actually works |
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 | |
sudo apt-get update | |
sudo apt-get install irb libopenssl-ruby libreadline-ruby rdoc ri ruby ruby-dev | |
cd /usr/local/src | |
sudo wget http://production.cf.rubygems.org/rubygems/rubygems-1.5.2.tgz | |
sudo tar -xzf rubygems-1.5.2.tgz | |
cd rubygems-1.5.2 | |
sudo ruby setup.rb | |
sudo update-alternatives --install /usr/bin/gem gem /usr/bin/gem1.8 1 | |
sudo gem update --system |
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 | |
# cd /tmp/ && wget https://raw.github.com/gist/1381894/install-puppet.sh && bash ./install-puppet.sh | |
sudo apt-get install libopenssl-ruby rdoc libopenssl-ruby1.8 libreadline-ruby1.8 libruby1.8 rdoc1.8 ruby1.8 | |
cd /tmp/ | |
wget http://downloads.puppetlabs.com/facter/facter-1.5.7.tar.gz | |
tar xvzf facter-1.5.7.tar.gz | |
cd facter-1.5.7 | |
sudo ruby install.rb | |
cd .. | |
rm -rf facter* |
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
# This is an example of how I use capistrano in a sweet symphony to deploy a SilverStripe site. | |
# | |
# If you haven't installed capistrano yet, now would be a good time to do it. | |
# | |
# sudo gem install capistrano | |
# | |
# Have a look at http://cheat.errtheblog.com/s/capistrano/ for some tricks. | |
# Otherwise http://theadmin.org/articles/capistrano-variables/ shows most vars | |
# And here is the original deploy.rb https://github.com/capistrano/capistrano/blob/master/lib/capistrano/recipes/deploy.rb |
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 | |
git config --global alias.ls "log --pretty=format:'%Cred%h%Creset %C(yellow)%ci%Creset %s - %C(bold blue)%an%Creset'" |
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 | |
/** | |
* ContentAwareImage | |
* | |
* @author stig | |
*/ | |
class ContentAwareImage { | |
protected static $start_time = 0.0; |
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 | |
/** | |
* This script will drop all the databases that contains this string 'tmpdb'. | |
* Those databases are likely to be left over from a SilverStripe test run | |
* Usage: Make sure you change the db connection string below and run the | |
* script like: | |
* php remove-tmp-db.php | |
*/ | |
// Change this to your db connection |
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 | |
// An example on how to parse massive XML files with PHP by chunking it up to avoid running out of memory | |
// Open the XML | |
$handle = fopen('file.xml', 'r'); | |
// Get the nodestring incrementally from the xml file by defining a callback | |
// In this case using a anon function. | |
nodeStringFromXMLFile($handle, '<item>', '</item>', function($nodeText){ | |
// Transform the XMLString into an array and |