JQuery Tips #1

.wrap() vs wrapAll()

Simply wrap HTML around an element. The wrapAll() method will wrap all the elements matched into another element whereas the .wrap() method which wraps the matched elements individually. The example wraps an img tag with anchor.

$j("img#tooltip").wrap('<a href="#" id="show_tooltip"/>');

Adding a row in the middle of the table

If you want to add an additional row in between the table rows than .after() or .insertAfter() is way to do.

var newrow = $j('<tr><td colspan=2></td></tr>');



The only difference between the two is that .insertAfter() returns all inserted elements whereas .after() has no return value. The detailed explanation can be read from this link.

Tooltip is a useful interface paradigm. Its use can explore the action without invoking. tooltip can be set using jquery or with css. The css example can be found here.

With jquery it can be done with .tooltip()


Laravel Tips #1

Helper function – array_add() (laravel 5.2): link

The method appends the key/value pair  to the existing array.  This can be useful when adding additional fields when creating new record with request all() method. If the form and database field names are same than just pass the request->all() method. If you still see that the input is not creating new record than you must define all your fillable fields under the model.

For example:

$new_department = Department::create(array_add($request->all(),'company_id',Auth::user()->company->first()->id));


$data = $request->all();
$data['company_id'] = Auth::user()->company->first()->id;

Use pluck vs list (laravel 5.2) : link 

The pluck method returns an array. Both method to do the same thing.

For example:

 $this->departments->whereCompanyId(Auth::user()->company->first()->id)->pluck('name', 'id')

Amazon Business Model

As we all know that Amazon is one of the leading eCommerce business model where they think like technology company and agile methodology.

This article shows the seven things to know about Amazon business model.

  1. Vision   
    Growth versus profit – focused more towards growth and innovation than making profit. Thinking about the future than present.
  2. Size (BBP)
    Building – build unique brands (Amazon Basics, Amazon Fresh, Amazon Studios, Amazon Warehouse Deals)
    Buying – Amazon bought about 30 companies to built its enterprise
    Partnering – partnership with other companies to assist them on their on-line presence or sell their products in Amazon.
  3. Rapid Growth
    Revenue of 2.8B in first 5 years ahead of its competitors such as ebay and google.
  4. Information Technology  – core competency
    Amazon uses cloud computing, Amazon Web Services, Prime Instant Video, Fire TV
  5. Most innovative company
    Innovation is the vision of the company
  6. Keys to business strategy
    Focus on on-line business, control customer accounts and establish an ecosystem around Kindle and Kindle Fire products.
  7. Future Expand
    Kindle and Kindle Fire Ecosystem, Same day delivery, create Amazon supply and more focus towards digital products.

I think it is a great inspiration if someone wants to set-up their own business.