og-shawn-crigger / bonfire-snippets

Bonfire Snippets for Sublime Text Editor 2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bonfire Snippets for Sublime Text Editor

Just a random collection of Snippets I use for CI-Bonfire , development in Sublime Text Editor. I highly suggest using these with the Offical CodeIgniter Snippet package released and maintained by Marco Monteiro

Feel free to fork and add your own to the mix

Installation

Currently installation is manual via GIT, Sorry I have no clue where Windows stored it's Packages but I'm sure a quick google search will find it for you.

  • Mac Installation

    git clone git@github.com:svizion/bonfire-snippets.git ~/Library/Application\ Support/Sublime\ Text\ 2/Packages/bonfire-snippets

  • Linux Installation

    git clone git@github.com:svizion/bonfire-snippets.git ~/.config/sublime-text-2/Packages/bonfire-snippets

Current Snippets

These are the current snippets I've included, left hand side is the trigger, right hand side is what happens.

Template and Assets

Tab TriggerOutput
set_data Template::set();
render Template::render();
toolbar_title Template::set('toolbar_title', '');
clear_cache Assets::clear_cache();
add_js Assets::add_js();
add_css Assets::add_css();
add_mod_js Assets::add_module_js();
add_mod_css Assets::add_module_css();

Various Randoms

Tab TriggerOutput
cur_user $this->current_user->?
bf_model Generates Bonfire Model Skeleton Structure
auth_controller Generates Authenticated_Controller Skeleton Structure
haz_perm PHP If Wrapper for has_permission check
restrict $this->auth->restrict();
log_activity $this->activity_model->log_activity($this->current_user->user_id(), '', 'module');
settings_set $this->settings_lib->set();
settings_delete $this->settings_lib->delete();

Bonfire Module Snippets

<tr>
	<td>count_by</td>
	<td>$num = $this->$1_model->count_by('$2', '$3');</td>
</tr>
</tbody>
Tab TriggerOutput
find $records = $this->$1_model->find($2);
find_by $records = $this->$1_model->find_by('$1', '$2');
find_all_by $records = $this->$1_model->find_all_by('$1', '$2');
insert $id = $this->$1_model->insert($2);
update $result = $this->$1_model->update($2, $data);
update_where $result = $this->$1_model->update_where('$2', '$3', \$${4:$data});
delete $result = $this->$1_model->delete($2);
delete_where $result = $this->$1_model->delete_where('$2', '$3');

Debugging snippets I use some are not fully Bonfire related.

</tbody>
Tab Trigger Output
cplog ChromePhp::log($1);
cperror ChromePhp::error($1);
console Console::log($1);
enable_profiler $this->output->enable_profiler(FALSE);
bflog parent::logit($1, '${2:error]');
log logit($1, '${2:error]');
dad $dump()die;

Follow me else where

  • My Blog lots of guides and articles on CodeIgniter, Bonfire and Web Development.
  • Twitter lots of insanity by your's truly

About

Bonfire Snippets for Sublime Text Editor 2