Skip to main content

Posts

2016


Ajaxify Your Laravel Application Automatically

Ajaxify Your Laravel Application Automatically

You have a “nice little” Laravel app. You return views from your controllers, you redirect with a flash message when you’re done with something or when something goes wrong.

But sometimes you need to send Ajax requests to the server. And this time those views and redirects don’t make sense. You need JSON response. You create two different methods in your controller, one returns JSON and one returns View, because you also want the page to be loaded from server when user(or search engines) hit the url directly. And now things start to get messy.

Programing Best Practices Violation Fear

Programing Best Practices Violation Fear

Imagine a man named Bob who has a fatal disease and he has a very low chance of living more than a year. Expensive and regular treatment may save him.

Bob needed a new laptop so that he can earn some money from home, he bought one with $400 which comes with 1 year warranty. The sales girl asked him if he needs additional protection plan for $100 which will give him 3 more years of warranty? Bob thought that’s a great deal, it will make his laptop secure for 3 more years and he won’t have to worry about it anymore, but then he thought, even his life is not guaranteed for one year, why would he care about 4 years? It is much better for him to spend $100 on his treatment, it’s the priority now. Bob did not buy the additional protection plan. Smart decision, right?

2015


My Lifestyle - Apps and Productivity

My Lifestyle - Apps and Productivity

Since my childhood, I have always been obsessed with technology. Today I am gonna share with you, how I handle my day to day life using technology. This article just covers some productivity tools that I use. If you find this article helpful then leave a comment down below. If it seems that it’s helping many people then in future I will write about how I handle work, communication, finance, health etc.

2014


Charisma - free, responsive, multiple skin admin template

Charisma - free, responsive, multiple skin admin template

Charisma is a full featured, free, premium quality, responsive, HTML5 admin template (or backend template) based on Bootstrap 3 from Twitter, it comes with 9 different themes to suit your style and application type.

Charisma helps you minimize the repeat work you have to do on you projects. You can re-use Charisma as a base or as a package for your admin panel. It’s free for personal and commercial use and you can use it in multiple sites.

Why Many Good Developers Don't Get a Good Job

Why Many Good Developers Don't Get a Good Job

I have seen lots of really good developers looking for work and they don’t find good work for months or years. On the other hand I’ve seen some really good companies looking for developers and they don’t find good developer for months or years. What’s the problem? After looking at the situation of some of the developers and companies I have tried to find out the reason behind it. Let me share my thoughts with you.

New York Trip and The Laravel Conference

New York Trip and The Laravel Conference

I work remotely for Vegan Cuts, which is based in Canada and I work from Bangladesh. As the team is distributed, Vegan Cuts arranges meetings every year in different countries. This time I was invited to visit New York :).

It was a long journey for me, Sylhet > Dhaka > Istanbul > New York City, 20+ hours just in flight. I took 1.5 day break in Istanbul and explored the city, amazing, I must say.

Don't Fear Exceptions

Don't Fear Exceptions

If you’re not one of the few, you surely get scared once you see one of these:

Fatal error: Uncaught exception ‘Exception’ with message ‘Not found’ in /home/usman/www/test.php on line 27

Fatal error: Uncaught exception ‘UnexpectedValueException’ in /home/usman/www/test.php on line 27

When you see Red or Orange screen with Exception you fear like you’ve committed a sin and just go back to code to repent. Congrats, you’re the majority.

What if I told you that Exceptions are no sin, rather blessings of object oriented programming?
What if I told you that an Exception doesn’t just mean that your code is wrong?

2013


Strana - Smart Pagination Library for PHP

Strana - Smart Pagination Library for PHP

A framework agnostic, smart pagination library for PHP. Just a few lines of code and fully functional pagination is ready.

Paginate your records with Strana. Strana will slice(limit and offset) these records, generate pagination links for you and reads page number from them, all automatically.

Features: #

  • Built-in adapters for Doctrine, Eloquent (Laravel), Pixie, PHP Array and you can do it manually.
  • Readable syntax
  • Add Infinite Scroll with one line
  • It automatically detects which DBAL you are using.
  • Styles automatically with Twitter Bootstrap, Zurb Foundation and most of other CSS frameworks.

Check out the installation instructions and documentation on GitHub.

Pixie - A Database Query Builder for PHP

Pixie - A Database Query Builder for PHP

It took me few weeks to build Pixie, a lightweight, expressive, framework agnostic query builder for PHP, it can also be referred as a Database Abstraction Layer. Pixie supports MySQL, SQLite and PostgreSQL and it takes care of query sanitization, table prefixing and many other things with a unified API. At least PHP 5.3 is required.

It has some advanced features like:

  • Query Events
  • Nested Criteria
  • Sub Queries
  • Nested Queries
  • Multiple Database Connections.

Check out the installation instructions and documentation on GitHub.

PHP Router in 140 Characters

PHP Router in 140 Characters

This is a dimple(damn simple) URL routing script for PHP which is written in just 140 characters of code, so it fits within a tweet.

It’s NOT a good router at all, don’t use it in a real application, it’s not exception handled either. I did it just for fun and to demonstrate the simplicity.

So here’s the router code, and that’s all (seriously).

   
class R{  
function a($r,callable $c){$this->r[$r]=$c;}  
function e(){$s=$_SERVER;$i='PATH_INFO';$p=isset($s\[$i])?$s[$i]:'/';$this->r[$p\]();}  
}  

Fork on GitHub