View ps1.sh
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 bashp='subl ~/.bash_profile' | |
alias ll='ls -lhaG' | |
alias refresh='. ~/.bash_profile' | |
alias zend='sudo /usr/local/zend/bin/zendctl.sh' | |
alias sites='cd ~/Sites' | |
alias hubot='cd ~/Sites/hubot;bin/hubot' | |
alias subl='/Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl' | |
alias mongo_start='launchctl load -w ~/Library/LaunchAgents/org.mongodb.mongod.plist' | |
# PS1 prompt color vars |
View backtype.php
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
/** | |
* @name backtype | |
* @author Nithin Meppurathu | |
* @author_url http://www.nitmedia.com | |
* @version 1.1 | |
* @license Do Not distribute under any terms | |
* | |
* Backtype library for Codeigniter. | |
* Class Helps us connect with the backtype api and get back results. | |
* |
View gist:1312794
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
1)In ~/.bash_profile make sure | |
--------------------------------------- | |
PATH=$PATH:/usr/local/zend/bin:/usr/local/zend/mysql/bin | |
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/zend/lib | |
2) | |
sudo ln -s /usr/lib/libltdl.7.dylib /usr/lib/libltdl.3.dylib | |
3) | |
sudo pear channel-discover pear.php-tools.net |
View gist:1893463
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
$exists = $this->db->select(‘id’)->where(‘id’, $id)->get()->row_array(); | |
if($exists) | |
{ | |
$this->some_model->add($data); | |
} | |
else | |
{ | |
$this->some_model->update($data); | |
} |
View gist:1893479
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
INSERT INTO | |
`product` | |
SET | |
`id`=? | |
,`name`=? | |
,`created_at`=NOW() | |
ON DUPLICATE KEY UPDATE | |
,`name`=? | |
'; | |
$stmt = mysqli_prepare($dbh, $sql); |
View gist:1893482
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
require_once(BASEPATH.'database/DB_driver.php'); | |
if ( ! isset($active_record) OR $active_record == TRUE) | |
{ | |
require_once(BASEPATH.'database/DB_active_rec'.EXT); | |
// get the CI instance | |
$CI = & get_instance(); | |
$prefix = $CI->config->item('subclass_prefix'); |
View gist:1893486
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
<? | |
class MY_DB_active_record extends CI_DB_active_record | |
{ | |
function on_duplicate_update($table = '',$fields = NULL,$set = NULL) | |
{ | |
if ( ! is_null($set)) | |
{ | |
$this->set($set); | |
} |
View gist:1893489
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
<? | |
class MY_DB_mysqli_driver extends CI_DB_mysqli_driver | |
{ | |
final public function __construct($params) | |
{ | |
parent::__construct($params); | |
} | |
function _insert_on_duplicate_update($table, $update, $values) |
View gist:1893490
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
class MY_Loader extends CI_Loader { | |
/** | |
* Database Loader | |
* | |
* @access public | |
* @param string the DB credentials | |
* @param bool whether to return the DB object | |
* @param bool whether to enable active record (this allows us to override the config setting) | |
* @return object |
View gist:1893494
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
$update = array_keys($data); | |
unset($update['created_at']); | |
$this->db->set($data)->on_duplicate_update('product',$update); |
OlderNewer