Skip to content

Instantly share code, notes, and snippets.

@simkimsia
simkimsia / deploy.rb
Created October 30, 2010 12:41
deploy.rb for copying files after deploy for staging
# setting for staging environment
task :staging do
# If you aren't deploying to /u/apps/#{application} on the target
# servers (which is the default), you can specify the actual location
# via the :deploy_to variable:
set :deploy_to, "/var/www/staging"
after("deploy:default", :copy_config_files)
end
#Deployment tasks
#!/bin/sh
sed -i 's/Configure::write('debug', 2);/Configure::write('debug', 0);/g' /opt/lampp/htdocs/wp/app/config/bootstrap.local.php
# idea is bootstrap.local.php is the file
# original string is Configure::write('debug', 2);
# replace it with Configure::write('debug', 0);
@simkimsia
simkimsia / RunAppTests.sh
Created March 23, 2012 04:30
how to do a bash script for myapp app folder
#!/bin/bash
cp myapp/Config/core.php myapp/Config/core.php.backup
echo "Configure::write('Acl.database', 'test');" >> myapp/Config/core.php
lib/Cake/Console/cake testsuite -app myapp app
mv myapp/Config/core.php.backup myapp/Config/core.php
@simkimsia
simkimsia / ubuntu-11xx-nginx-base.sh
Created May 5, 2012 01:18 — forked from predominant/ubuntu-1104-nginx-base.sh
Install Ubuntu 11.x Nginx web server w/ PHP-FPM, MySQL,CakePHP, PEAR, PHPUnit
#!/bin/bash
###
#
# forked from https://gist.github.com/1264701/08f93534ba177f173b9382b53c419cd0de5b07ea
# Copyright (c) 2011 Cake Development Corporation (http://cakedc.com)
#
# Ubuntu 11.04 based web server installation script
# Run this by executing the following from a fresh install of Ubuntu 11.04 server:
#
@simkimsia
simkimsia / ubuntu-11xx-fabric-base.sh
Created May 8, 2012 00:32
install Ubuntu 11.x Python, Pip, Fabric
#!/bin/bash
###
#
# Copyright (c) 2012 https://github.com/simkimsia
#
# Ubuntu 11.04, 11.10 based installation script for Python, Pip and Fabric
# Run this by executing the following from a fresh install of Ubuntu 11.04, 11.10 server:
#
# bash -c "$(curl -fsSL https://raw.github.com/gist/2631668)"
@simkimsia
simkimsia / ubuntu-11.xx-jenkins-install.sh
Created May 13, 2012 10:40
Install Jenkins and related dependencies
#!/bin/bash
###
#
# forked from https://gist.github.com/1264701/08f93534ba177f173b9382b53c419cd0de5b07ea
# Copyright (c) 2011 Cake Development Corporation (http://cakedc.com)
#
# Ubuntu 11.xx server installation script for Jenkins
# Run this by executing the following from a fresh install of Ubuntu 11.xx server:
#
@simkimsia
simkimsia / index.php
Created June 5, 2012 15:36
for learning GET params
<?php
//Define an array of character information
$characters = array(
'yakko' => array (
'id' => 'yakkowarner',
'url' => 'characterview.php?id=yakkowarner',
'name' => 'Yakko Warner'
),
@simkimsia
simkimsia / annotate.php
Created June 22, 2012 07:45
annotate english or chinese text on image
<?php
header('Content-Type: text/html; charset=utf-8');
mb_internal_encoding('utf-8');
function wordWrapAnnotation(&$image, &$draw, $text, $maxWidth)
{
// separate the text by chinese characters or words or spaces
preg_match_all('/([\w]+)|(.)/u', $text, $matches);
// $words is array of Chinese characters, English Words or spaces
@simkimsia
simkimsia / OauthAuthorize.php
Created June 22, 2012 15:10
Florian code for OauthAuthorize
<?php
App::uses('BaseAuthorize', 'Controller/Component/Auth');
class OauthAuthorize extends BaseAuthorize {
public function authorize($user, CakeRequest $request) {
$Acl = $this->_Collection->load('Acl');
$Oauth = $this->_Collection->load('Oauth');
$user = array($this->settings['userModel'] => $Oauth->user());
return $Acl->check($user, $this->action($request));
}
}
@simkimsia
simkimsia / installation.txt
Created July 20, 2012 08:07
install cakephp, nginx, php, mysql for fresh version of mac
Today, Apple added a beautiful new package to their official developer tools suite: Command Line Tools for Xcode. It's a 171 MB download that includes all of the tools a Homebrew should ever need. Best of all, it contains the proprietary headers that I couldn't ship myself.
You can download and try it out today. All you need is a free Apple ID.
You'll want to uninstall Xcode first:
$ sudo /Developer/Library/uninstall-devtools --mode=all
Major props to Apple for making this happen.
follow rest of instructions here http://www.rabblemedia.net/installing-nginx-php-fpm-and-mysql-drupal-osx-lion-homebrew