Skip to content

Instantly share code, notes, and snippets.

View mogetutu's full-sized avatar

Isaak Mogetutu mogetutu

View GitHub Profile
@mogetutu
mogetutu / MY_Model_access
Created April 15, 2012 11:00
Use of Codeigniter MY_Model functions
<?php
$row = $this->article_model->get(2);
//stdClass Object ( [body] => Fuzzy Wuzzy was a bear; Fuzzy Wuzzy had no hair. Fuzzy Wuzzy wasn't very fuzzy, was he? [title] => Fuzzy Wuzzy [id] => 2 )
//SELECT * FROM (`articles`) WHERE `id` = 2
$row = $this->article_model->get_by('title', 'Fuzzy Wuzzy');
//stdClass Object ( [body] => Fuzzy Wuzzy was a bear; Fuzzy Wuzzy had no hair. Fuzzy Wuzzy wasn't very fuzzy, was he? [title] => Fuzzy Wuzzy [id] => 2 )
//SELECT * FROM (`articles`) WHERE `title` = 'Fuzzy Wuzzy'
// NOTE: if more than 1, returns first
@mogetutu
mogetutu / osx_mysql_ownership_fix
Created April 22, 2012 23:16
'warning the user/local/mysql/data directory is not owned by the mysql user', you have to:
sudo chown -RL root:mysql /usr/local/mysql
sudo chown -RL mysql:mysql /usr/local/mysql/data
sudo /usr/local/mysql/support-files/mysql.server start
@mogetutu
mogetutu / gist:3023677
Created June 30, 2012 13:06 — forked from mikemorris/gist:2166324
Build PHP 5.4.0 from source with i18n support for MacOS X 10.7 Lion
# Download, configure, make and install International Components for Unicode
wget http://download.icu-project.org/files/icu4c/49.1/icu4c-49_1-src.tgz
tar xzvf icu4c-49_1-src.tgz
cd icu/source/
./runConfigureICU MacOSX
make
sudo make install
# Install libjpeg support for GD
brew install jpeg
@mogetutu
mogetutu / CI_Date.php
Created August 31, 2012 09:41 — forked from kylefarris/CI_Date.php
Codeigniter Date Library
<?php
class CI_Date {
public $sec_in_min, $min_in_hour, $hr_in_day, $day_in_wk, $sec_in_wk, $sec_in_day, $min_in_wk, $min_in_day, $hr_in_wk;
public function __construct() {
$this->sec_in_min = 60;
$this->min_in_hr = 60;
$this->hr_in_day = 24;
$this->day_in_wk = 7;
$this->day_in_yr = 365;
$this->sec_in_hr = $this->sec_in_min * $this->min_in_hr;
@mogetutu
mogetutu / gist:3608329
Created September 3, 2012 10:12
A simple concept for basic JOIN statement in MY_Model
public function __call($method, $parameters)
{
if (strpos($method, 'with_') === 0)
{
$table = substr($method, 5);
return $this->with($table, $parameters[0]);
}
throw new \Exception("Method [$method] is not defined on the Model class.");
}
HTML code:
<div id="myModal" class="modal hide fade">
<div class="modal-header">
<button class="close" data-dismiss="modal">&times;</button>
<h3>Title</h3>
</div>
<div class="modal-body">
<div id="modalContent" style="display:none;">
@mogetutu
mogetutu / Presentations Links
Created September 26, 2012 16:44
Presentations Links
@mogetutu
mogetutu / snippet.xml
Created October 21, 2012 21:16
Laravel Resource - Sublime Text 2 Snippet
<snippet>
<content><![CDATA[
// ${1} Resource
Route::get('${1}s', array('as' => '${1}s', 'uses' => '${1}s@index'));
Route::get('${1}s/(:any)', array('as' => '${1}', 'uses' => '${1}s@show'));
Route::get('${1}s/new', array('as' => 'new_${1}', 'uses' => '${1}s@new'));
Route::get('${1}s/(:any)edit', array('as' => 'edit_${1}', 'uses' => '${1}s@edit'));
Route::post('${1}s', '${1}s@create');
Route::put('${1}s/(:any)', '${1}s@update');
Route::delete('${1}s/(:any)', '${1}s@destroy');
@mogetutu
mogetutu / snippet.xml
Created October 21, 2012 21:16 — forked from JeffreyWay/snippet.xml
Laravel Resource - Sublime Text 2 Snippet
<snippet>
<content><![CDATA[
// ${1} Resource
Route::get('${1}s', array('as' => '${1}s', 'uses' => '${1}s@index'));
Route::get('${1}s/(:any)', array('as' => '${1}', 'uses' => '${1}s@show'));
Route::get('${1}s/new', array('as' => 'new_${1}', 'uses' => '${1}s@new'));
Route::get('${1}s/(:any)/edit', array('as' => 'edit_${1}', 'uses' => '${1}s@edit'));
Route::post('${1}s', '${1}s@create');
Route::put('${1}s/(:any)', '${1}s@update');
Route::delete('${1}s/(:any)', '${1}s@destroy');
@mogetutu
mogetutu / Steps to take
Created October 27, 2012 11:19 — forked from gerritwessels/Steps to take
Mac OSX Mountain Lion Brew, Nginx, PHP53 + FPM Setup & Configuration
Thanks to:
http://realityloop.com/blog/2012/07/03/nginx-mariadb-php-aegir-mac-os-x-optional-drush-5-works-mountain-lion
and
http://robots.thoughtbot.com/post/27985816073/the-hitchhikers-guide-to-riding-a-mountain-lion
--Fresh install Mountain Lion.
--Install XCode 4.4.2
--Install Command line utilities via Xcode
--Install Homebrew