Skip to content

Instantly share code, notes, and snippets.

View alex-zige's full-sized avatar
🤞
Focusing

Alex Z. Li alex-zige

🤞
Focusing
View GitHub Profile
@alex-zige
alex-zige / login.php
Created July 29, 2011 04:43
Customized Login control
public function signup($data,$form){
Debug::show($data);
//get the Rego and Password
$rego=$data['RegoNo'];
$pwd=$data['Password'];
$flag=$this->validuser($rego,$pwd);
Debug::show($flag);
@alex-zige
alex-zige / gist:1989996
Created March 7, 2012 00:10 — forked from padolsey/gist:527683
Javascript: IE Detect
// ----------------------------------------------------------
// A short snippet for detecting versions of IE in JavaScript
// without resorting to user-agent sniffing
// ----------------------------------------------------------
// If you're not in IE (or IE version is less than 5) then:
// ie === undefined
// If you're in IE (>=5) then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
// if (ie) {}
@alex-zige
alex-zige / gist:1990174
Created March 7, 2012 00:52
php:carcompany
if ($this->ReList == 1 && $this->PAltID==""){
// if the relist button been clicked at same time no PALT saved;
$this->AltID = (isset($this->vin))? substr($this->vin,-6).rand(100,999) : "Error";
$this->PAltID=$this->AltID;
@alex-zige
alex-zige / gist:1996710
Created March 7, 2012 22:27
Magento: Illegal scheme supplied fix
<?php
/**
* Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
@alex-zige
alex-zige / gist:2018978
Created March 12, 2012 00:56
makedown:magento dps
###Magento DPS Problem
#problem with Magento DPS
#Shipping address within NZ works fine. Shipping outside NZ using DPS payment failed even though the credit card transaction has been approved.
# changed the rounding from 2 digits to 4 digits for correcting the rounding amomunt. but seesm it break on the DPS default 2 digits rounding seting.
@alex-zige
alex-zige / gist:2094243
Created March 19, 2012 04:04
silverstripe:homepage-buckets
<?php
class HomePage extends Page{
public static $db = array(
'bucket1_title'=>'Text',
'bucket2_title'=>'Text',
'bucket3_title'=>'Text',
@alex-zige
alex-zige / gist:4271821
Created December 12, 2012 21:33
better looking bash_profile + integrated with git
GitHub:Gist GitHub:Gist
public
mdigital / gist:2907430
.bash_profile including set_title and git prompt
Gist Detail
Revisions 1

Deploy your site with git

This gist assumes:

  • you have a local git repo
  • with an online remote repository (github / bitbucket etc)
  • and a cloud server (Rackspace cloud / Amazon EC2 etc)
    • your (PHP) scripts are served from /var/www/html/
    • your webpages are executed by apache
  • apache's home directory is /var/www/
@alex-zige
alex-zige / gist:5334449
Created April 8, 2013 05:37
Rspec expect -> change syntax
context "when created" do
it "tracked into activities " do
expect{FactoryGirl.create(:drink_report)}.to change(Activity.count).by(1)
end
end
error : Failure/Error: expect{FactoryGirl.create(:drink_report)}.to change(Activity.count).by(1)
TypeError:
nil is not a symbol
@alex-zige
alex-zige / gist:5381118
Last active December 16, 2015 04:59
Zeus Rspec super fast testing. [better testing suite ]

Zeus + Rspec + Guard [better testing suite ]

Zeus is great spork-like tool for forking the rake enviroment for better performance. It's great for rspec even faster than spork with ndb setup.

#install Zeus

gem install zeus

#install Zeus for guard