Solving a problem with Installing PHPunit on Mountain Lion

After following an instruction of installing PHPUnit on Mountain Lion, I had a following error in my terminal.

# phpunit
PHP Warning:  require(/usr/lib/php/pear/PHPUnit/Autoload.php): failed to open stream: 
No such file or directory in /usr/bin/phpunit on line 43

If you have the same error, you need to edited /usr/bin/phpunit, replacing this:

require '/usr/lib/php/pear' . DIRECTORY_SEPARATOR . 'PHPUnit' . DIRECTORY_SEPARATOR . 'Autoload.php';
    

with

require '/Users/yourname/pear/share/pear' . DIRECTORY_SEPARATOR . 'PHPUnit' . DIRECTORY_SEPARATOR . 'Autoload.php';

Cloning a github repo through Sublime Text 2


The previous post can be extended to download any framework such as CodeIgniter or Laravel.

After installing Shell-Turtlestein through Package Control, create a new snippet called clonelaravel.

<snippet>
	<content><![CDATA[
mkdir clonehere; cd clonehere; git clone https://github.com/laravel/laravel.git; mv laravel/* ../; cd ../; rm -R clonehere;
]]></content>
	<tabTrigger>clonelaravel</tabTrigger>
	<scope>source.shell</scope>
</snippet>

This code create a directory ‘clonehere’ and change directory to ‘clonehere’. Clone from git and move all the files under laravel to one directory up. Change the directory to one up and remove recursively all the files in the clonehere directory.
You just need to change a github address for other framework. For example for CodeIgniter save the following as a snippet cloneci.

<snippet>
	<content><![CDATA[
mkdir clonehere; cd clonehere; git clone https://github.com/EllisLab/CodeIgniter.git; mv CodeIgniter/* ../; cd ../; rm -R clonehere;
]]></content>
	<tabTrigger>cloneci</tabTrigger>
	<scope>source.shell</scope>
</snippet>

Shift+Command+c, type clonelaravel and click tab and enter to run it.

Using bash script on Sublime Text 2


By using Shell-Turtlestein and snippet, you can use bash script on Sublime Text 2 to assist us creating a project.

Here you can find how to do it with Alfred. Please have a look at the video. But I will show you here how to do it within Sublime Text 2. I tested it with Mac. But it should work in Windows with little code changes.

First you create a Template directory and add necessary folder and files except backbone, jquery etc.


~/Template/backbone/
     index.html
     assets/
           css/
           js/
              libs/
              models/
              views/

Now you need to install Shell-Turtlestein through Package Control. Shift+Command+p to open Package Control and type ‘install’. Then type Turtlestein to find Shell-Turtlestein to install.

You need to create a snippet in Sublime Text 2. Goto Tools>New Snippet and enter the following and save as backbone.sublime-snippet(create a folder shell under ~/Library/Application Support/Sublime Text 2/Packages/User/shell/backbone.sublime-snippet).

<snippet>
	<content><![CDATA[
	cp -R ~/Templates/Backbone/ . ; curl http://backbonejs.org/backbone-min.js > assets/js/libs/backbone.js ; curl http://underscorejs.org/underscore-min.js > assets/js/libs/underscore.js ; curl http://code.jquery.com/jquery.js > assets/js/libs/jquery.js ; /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl .
]]></content>
	<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
	<tabTrigger>bb</tabTrigger>
	<!-- Optional: Set a scope to limit where the snippet will trigger -->
	<scope>source.shell</scope>
</snippet>

Now all are ready to execute it. Create a folder and a file called index.php in Sublime. Then Shift+Command+c to open a Shell-Turtlestein console. Type bb +tab to display commands, then enter to run it.

You should have backbone-min.js, underscore-min.js and jquery.js under js folder and all other folders and files you created under ~/Template folder.

Kaimonokago 2.0 released

After long time, I have upgraded Kaimonokago. It is a
Multi-Languages Shopping Cart running on CodeIgniter 2.1.0 and BackendPro 0.6.7 and also PHP 5.3 compatible.

Some features.

  • Multi-languages menu, page content, product content etc.
  • Email order notice to admin and cutomer
  • Admin login, forgot password function
  • Admin Event calendar
  • Admin Page management
  • jQuery Drop-down site menu
  • Different types of slideshow
  • Admin Product management
  • Customer News letter subscription
  • Customer Login system
  • Customer management
  • Admin File management
  • Admin Menu management
  • Admin Order management
  • Admin Ajax messages
  • Dashboard/RSS feeds
  • Dashboard/Google Analytics
  • Dashboard/Twitter
  • Sharethis
  • Email template system

Download from github

 

Continue reading Kaimonokago 2.0 released

Uploading csv file with Codeigniter

I could not upload csv file. But you can upload it by changing confi/mimes.php line.

// instead of this
$mimes = array(	'hqx'	=>	'application/mac-binhex40',
				'cpt'	=>	'application/mac-compactpro',
				'csv'	=>	array('text/x-comma-separated-values', 'text/comma-separated-values', ...

// add 'text/plain', as follows
'csv'	=>	array('text/plain','text/x-comma-separated-values',

This should fix the problem.

25 Spotify invitations give away

UPDATE: I just emailed the last invitations today, so there are no more to send.

I have been using Spotify more than a year. And I have 25 Spotify invitations to give away. I read CNN news telling that Spotify is available in the U.S. by invitation only — or for paying customers.

If you are interested in getting a Spotify invitation, please leave your comment here.

sharethis_helper for CodeIgniter

 

I have created a sharethis_helper for CodeIgniter and you can download from github.

How to use it

  1. Download it and place them in your CodeIgniter
  2. Open application/helper/sharethis_helper.php and change $sharethis_pub_key =‘Add your key here’; and $services = “facebook, twitter, email, sharethis, gbuzz”;
  3. You can find your sharethis publication key at http://sharethis.com
  4. To modify, open application/views/welcome_message.php

Continue reading sharethis_helper for CodeIgniter

RSS Feeds and Google Analytics added to Kaimonokago

I have added RSS feeds, Goolge Analytics and Orders widgets in its dashboard.

 

Continue reading RSS Feeds and Google Analytics added to Kaimonokago

Kaimonokago shopping cart updated

Kaimonokago is a shopping cart based on CodeIgniter. The current version is 1.1.4 and it has a multi-language functions.

I have added a quite few design changes in the back-end and some minor bug fixes. Please read README files for installation and other details.

Download from github

Demo

 

Norwegian Characters in CodeIgniter and Editor

I had a problem with Norwegian characters today. I found that my editor’s encoding was set to iso-8859-1, so I needed to change it to UTF-8. I kept the following in config.php in CodeIgniter.

$config['charset'] = "UTF-8";

Then I needed to retype all the Norwegian characters in the editor.

I set all database charset to UTF-8 as well.

DEFAULT CHARSET=utf8