08 2 / 2013

designcloud:

UP Coffee Table by Duffy London design studio

(Source: cosascool)

11 1 / 2013

When doing large project with multiple developer working on the same repo, you tend to have duplicate of function or in this case query. Like for an example, I’m working on a project to manage customer feedback thru their website.

One of the feature requested (or obviously must have) is to be able to mark the mail as junk, thus prevent other mail from the blacklisted recipients. In my case, we have a field named ‘mailbox’ and with one of the option is ‘junk’. So, here’s how we do it in cakePHP.

  1. You need to add custom find type, namely ‘junk’
  2. Next, you can call this from your controller and display it in your view

Hopes that help!

10 1 / 2013

I just noticed that I have inbox messages this morning. One of the request is to enable “color box” onload. I’m assuming that this is refering to jQuery lightbox plugin.

You can find details of the product at this page – ColorBox - a jQuery lightbox

In order to have the lightbox automatically load when page is loaded, you need to add the following codes to your script.

<script>
$(document).ready(function(){
  $.colorbox({
    href: "colorbox_popup.html",
    open: true
  });
});
</script>

This should automatically load the link “colorbox_popup.html” once the page has already loaded.

Notice that I don’t use $(selector), since we want the page to load itself without having to interact with other object.

Instead of loading external page, you can also use it to load html code like so:

<script>
$(document).ready(function(){

  $.colorbox({
    html: “<h1>hello, lightbox</h1>”,
    open: true
  });
});
</script>

All the best!

10 1 / 2013

apitminimalistic asked: As my leader. Do you think I'm a programmer or developer?

I like you as a programmer, but there are alot to learn. Let’s sit down and discuss.

25 12 / 2012

Thanks to macromates team for giving us free Textmate2  (for paid Textmate 1 customers). I notice that I have not covered this in my dev blog, althought I did covered this for Textmate 1 in here.

It almost like the previous one where you need to create a macro for this, so here’s the steps required:

  1. open Bundle editor by go to Bundles > Edit Bundles… menu
  2. then press Command-N and select Bundle. it will automatically keyed-in your name (Nurulazrad’s Bundle)
  3. then press Command-N again and select Command.
  4. key in details as follows, see embed figure.

  5. and you are done!

For the command, you may copy and paste from below:

#!/usr/bin/env bash

[[ -f “${TM_SUPPORT_PATH}/lib/bash_init.sh” ]] && . “${TM_SUPPORT_PATH}/lib/bash_init.sh”

perl -pe ‘s/[\t ]+$//g’ 

Actually, I copied this from this Text Bundle. Under the Menu Actions > Converting / Stripping > Remove Trailing Spaces in Document / Selection command

All the best!

21 12 / 2012

Most of the time we just pull repo from our Beanstalk repo when deploying to our client site. But, not all files are included due to .gitignore settings. If you are using CakePHP as your framework, it will automatically excluded the following directories like app/Config app/tmp, etc…

In order  to have application-1.0.zip or application-1.0.tar.gz, you need to rely on your skill playing with command line especially if you run any *nix os (mine i’m using a Mac). 

The following will help you how to create the required archived applications.

For zip file:

# assume we have the following setup
# ~/Sites/myproject

% cd ~/Sites

% zip -r9 /tmp/myproject-1.0.zip myproject -x myproject/.git\*

It will create a file named “myproject-1.0.zip” in your /tmp folder. Remember .git folder will contains all the changes done your project right from your first commit.

For tar.gz file:

#assume our setup as follow
# ~/Sites/myproject

% cd ~/Sites

% tar -cvzf /tmp/myproject-1.0.tar.gz —exclude=myproject\/.git myproject

If you notice for tar, the —exclude option reads pattern, so make sure you have the right pattern in order for it to work.

The advantage of this method is it reduced the file size and included all ignores files from git.

02 11 / 2012

madewithpaper:

Hand shadow.
by ciberfefo

madewithpaper:

Hand shadow.

by ciberfefo

23 10 / 2012

Due to big space in our account at beanstalk, we decided to have all projects under the same company to be created under one repo. I know this is not a good practice, but for a small company with tight budget, this is they way to go.

So, since git has set the default branch as master, we need to clone a specific branch under that repo. Now I’m working on new project called DBMS2, the following is how you can retrieve the DBMS2 branch.

mkdir dbms2; cd dbms2

git init

git remote add -t dbms2 origin [my.git.url]

git fetch

git checkout dbms2

Thus when I do git branch, it will list dbms2 branch only. Kewl!

17 10 / 2012

I’m not sure if the title is right or wrong. I know that there’s no such thing as local tracking branch. But what I want to do is to remove the local branch from being pushed when I do “git push”. Of course you have to do “git push -u <branch>” first, so that git knows that you want to keep traking <branch> when you do push.

From the search results, there are two (2) workable solutions.

1. git branch -d -r origin/<remote branch name>

I’m not sure if this is what I want. I don’t really want to delete the branch in the remote repo but only in my local repo.

2. This is the one that I did to remove my local branch copy and tracking while keeping my remote  branch in the origin/<branch>

git config --unset branch.<branch>.remote
git config --unset branch.<branch>.merge
git branch -d <branch>

Hopes that this will help others who need to remove tracking their local branch.

references:

30 8 / 2012

Good article regarding isset() and empty(). I would recommend avoid using empty() if possible and instead use strlen() for checking for empty string or array. Reason being non-assigned variables or empty assigned variables, both give the same result. I recommend you to read the article to understand when to use the isset() and empty() functions.