Skip to content

Instantly share code, notes, and snippets.

View jackii's full-sized avatar

Jacky jackii

  • Internet
  • 15:14 (UTC +08:00)
View GitHub Profile
# app/controllers/application_controller.rb
class ApplicationController < ActionController::Base
protected
# for datatables
def page
params[:iDisplayStart].to_i/per_page + 1
end
@jackii
jackii / backbone.rails.js
Created January 5, 2012 03:33 — forked from trydionel/backbone.rails.js
Makes Backbone.js play nicely with default Rails setup
//
// Backbone.Rails.js
//
// Makes Backbone.js play nicely with the default Rails setup, i.e.,
// no need to set
// ActiveRecord::Base.include_root_in_json = false
// and build all of your models directly from `params` rather than
// `params[:model]`.
//
// Load this file after backbone.js and before your application JS.
@jackii
jackii / build.xml
Created December 16, 2011 17:38 — forked from rodrigorm/build.xml
Ant build i'm using on CakePHP projects + Hudson CI
<project name="CakePHP" default="build">
<target name="clean">
<delete dir="build" />
</target>
<target name="prepare">
<mkdir dir="build/junit" />
<mkdir dir="build/logs" />
<chmod perm="a+rw">
<fileset dir="app/tmp" />
@jackii
jackii / compile_PHPUnit-3.5.15.sh
Created November 11, 2011 18:25 — forked from markomarkovic/compile_PHPUnit-3.5.15.sh
A script to compile PHPUnit-3.5.15 with all dependencies into archive which can be extracted to CakePHP 2.0 Vendor directory in order to UnitTest cake (if you don't have access to PEAR commands or PEAR insists on installing PHPUnit-3.6.0 and not working).
#!/bin/sh
# Creating temp dirs
mkdir .compile_PHPUnit_$$
cd .compile_PHPUnit_$$
# Fetching the archives
wget -nv http://pear.phpunit.de/get/PHPUnit-3.5.15.tgz
wget -nv http://pear.phpunit.de/get/DbUnit-1.0.0.tgz
wget -nv http://pear.phpunit.de/get/File_Iterator-1.2.3.tgz
# put this into .htaccess to disable eAccelerator
# especially for RecessFramework
php_flag eaccelerator.enable 0
php_flag eaccelerator.optimizer 0