"Stub" -ing

One of the most valuable lessons Ive learned in my development career is the art of stubing. (which works great with TDD by the way)

So what is stubing? Stubing is the act of “imagining” how your application will work by writing how you would use it first.

Before building this class I would write out what the class does and how I would use it.

$nithin = new Human(“Nithin Meppurathu”);

$nithin->sayName();

Now as you can see, i know exactly how I would use of the Human class. I want to create a new human with the humans name. Then I want to use the class to tell the application the name of the user.

Next step would be to write a quick interface for the class. And eventually create the class itself.

Laravel News

If you guys haven’t checked out Eric’s new blog for Laravel goodies, do so now!

Use Scalate .ssp with Play 2 Framework - Scala

Step 1:

In your repo navigate to /project/Build.scala

Under your appDependencies add

Step 2:

Navigate to conf/application.conf and add

Step 3: 

Create a new lib file in /app/lib/ call it something like ScalateIntegration.scala and copy the follow code into it

Step 4:

To use the templating system now you can reference scalte in your controller like this:

Additional Information:

1) The lib file states that your layout file will be location in /views/layouts/default (template_type_extension)

2) Within your template if you dont want to load the layout you can pass an empty string into the layout attribute

ssp: <% attributes(“layout”) = “” %>

3) Within your layout the view file data is passed in a html type variable called content

ssp declaration: @(content: Html)

ssp: @content

Version Gotchas

My current version setup are as follows

build.properties : sbt.version=0.12.2

plugins.sbt: addSbtPlugin(“play” % “sbt-plugin” % “2.1.1”)

"scalate-core_2.10" % "1.6.1"

All bootstrap sites look the same

So recently I had a couple of friends tell me that “All bootstrap sites look the same”. I wanted to write this article to explain that your doing it wrong.

Bootstrap by twitter is a great tool for helping you prototype and get started styling your application quickly and easily. It is meant to give you the foundational CSS that will get you going to create cross browser - responsive designed websites.

So I think the problem why the “incorrect usage” is happening is the bootstrap website. The website shows you the documentation of the core features of bootstrap, which is great. But the download and customize section is what throws off a new comer.

The best way to use Bootstrap is to not get it from their website.

The first thing to do to get started with bootstrap is to decide what kind of CSS compiler you want to use for your project. The two popular options are LESS and SASS.

Why use a compiler you might ask? Well you’ll have to keep reading for that answer. Compilers are amazing tools to help you write better and more organized CSS. They bring you programming logic into css by giving you variables and functions that help create css.

If your into node grab the LESS version of bootstrap files right from

https://github.com/twitter/bootstrap/tree/master/less

Now if your using any other language outside of node, my recommendation is to use the SASS (ruby) version.

https://github.com/thomas-mcdonald/bootstrap-sass/tree/master/vendor/assets/stylesheets

Once you have the source files in your project, you get the same customization options that they give you on the twitter bootstrap website customize page. Just use the variables file.

image

Bootstrap’s website relies on a 1000 line style sheet on top of Bootstrap.

If you don’t like how something looks and works, now you have the true source of these files to make your changes.

You don’t like the blue that bootstrap uses, change the variable for blue in one place and see the entire stylesheets blue change.

Bootstrap comes with amazing mix-ins (functions) that do all the heavy lifting for you. If you need a clear-fix that will work cross browser, why re-invent the wheel? Just use for SCSS “@include clearfix()”.

If you need rounded corners and need it to be cross browser, why memorize moz-kit and webkit syntax when you can just use “@include border-radius(5px)”, which will generate all the cross browser syntax for you.

Use bootstrap for what it is, a CSS foundation tool to build beautiful cross browser responsive websites, and never have any of your websites look like the default bootstrap styles again.

raghubhat2000: Hi I am new to CI, I am facing a funny issue. I have a form where I can Add / Edit & Delete Records. I want to have a duplicate check at the time of updating. I tried using several ways, but I am failing ... please help

please gist me your code so i can have a look at what your doing, please also provide me with any errors that your seeing. What not happening thats supposed to happen?

jeremyqbutler: How much do you charge for projects?

Depends on the project, the time it will take, so many factors, thats like asking how much would you pay for a car, depends on the car. I have a lot of people in line and only choose projects that I really believe in.

PHP Fedex Api - Another one to the horrible api list

So today I got the honor of working with the Fedex php api. After hours of hunt no one has built anything better. After reviewing it, i could probably consolidate these 80 Files, about 1000 Lines each page of code into 1 file under 2000 lines.. I think thats what ill just have to do.. Let me know if anyone has any other solutions.

Fedex.. a big boooo to you.. At least your documentation pdf isn’t so bad.. but couldn’t you have made the method names a little bit easier to get.

NEW UPDATE : https://github.com/chonthu/PHPFedexClass

tumblrbot: WHERE WOULD YOU MOST LIKE TO VISIT ON YOUR PLANET?

Australia, cant wait to go on the safari. Hopefully next year ill be able to go!

Codeigniter code Tidy for Sublime

Coming from netbeans, I love the way it did code formatting, one of the biggest things I missed when I made the switch to Sublime Text 2. But then I found a repo that implemented PhpTidy and formatted the code for Wordpress.

https://github.com/welovewordpress/SublimePhpTidy

So I thought why not just make this amazing and add in a feature set to support codeigniter style guide as well.

https://github.com/chonthu/SublimeCITidy

Currently Ive added some styling, but its still in progress, the repo didn’t come with menu action or setting page, so I added the menu and setting pages for Sublime will be out in the coming week, if anyone has any “wishes” for the repo let me know.

Currently on the wish list is:

1. In the setting section allow for user to select from available styleguides for popular php frameworks.

2. Allow in settings to turn on and off options such of short php tags and new line brackets.