Category Archives: Sh*ts

algolia – hosted cloud search as a service

 

LittleSnapper

 

Found Algolia the other day on https://cdnjs.com/.
Looks cool to try to look out it works…
They have a blog where they post some interesting articles about the service…

Moreover, Algolia is very easy to implement on your website as the company opted for a SaaS strategy. It means that you can implement the company’s search engine for database objects in just a few lines of code thanks to its hosted API, feed the service with JSON-formatted data, and customize it to your needs. After that, your users can start searching right away. They will interact with Algolia’s servers without ever leaving your site. With 12 different data centers across the world, Algolia tries to make the experience as responsive as possible for its users.

Source: http://techcrunch.com/2015/05/20/algolia-grabs-18-3-million-from-accel-for-its-search-api-on-steroids/

B-MobXdCUAARA6q

Some more readings

 

In Portugal we have a word similar to Algolia… and it isn’t good!

Continue reading algolia – hosted cloud search as a service

.imagesLoaded is not a function

I’m using mustache.js, masonry and I was trying to use imagesLoaded to avoid overlapping images.

My code was returning me .imagesLoaded is not a function
Some people on the interwebs said that disabling Rocket Loader in CloudFlare… didn’t work for me.

After more than 2 hours I got the solution – without using imagesLoaded -.

    $(window).load(function() {

      // Masonry Trigger
      var $container = $('#masonry-wrap');

      $container.masonry({
         // options
         itemSelector: '.masonry-box', 
         columnWidth: 283 
      });

    }); 

 

Solution was taken from jQuery masonry with WordPress and imagesLoaded and given by McNab!

MacBook Pro, no battery performance hack

Almost one year ago, I’v removed my Macbook Pro battery…
Since that day… my laptop was f*cking slow.

This is how I’v solved it – following the article from http://www.rdoxenham.com/?p=259.

Find out our model’s name
MacBook-Pro-de-Paulo:~ PJunior$ system_profiler -detailLevel mini | grep "Model Identifier:"
 Model Identifier: MacBookPro5,1
Do the sh*t!

Lets move to root

sudo bash

Lets go to the right folder

bash-3.2# cd /System/Library/Extensions/IOPlatformPluginFamily.kext/Contents/PlugIns/ACPI_SMC_PlatformPlugin.kext/Contents/Resources/

iTerm

Lets move the .plist of our model out of that folder…
– change the destination folder to your needs –

mv MacBookPro5_1.plist /Users/PJunior/

Reboot and it’s done.

All the credits go to http://www.rdoxenham.com/?p=259.

jQuery – Merge and sort JSONs objects

While I’m sketching a new project, and trying to maximize the server work…
I might need to join several JSON objects and order them by a value (timestamp).

This is a solution that I’v found on Stackoverflow.

arr1 = [{"link":"#","prod":"Fundamentals Of Software Engineering","price":" Rs. 201 "},{"link":"##","prod":"Real-Time Systems: Theory And Practice","price":" Rs. 390 "}];
arr2 = [{"link":"#","prod":"Fundamentals Of Software Engineering","price":" Rs. 202 "},{"link":"##","prod":"Real-Time Systems: Theory And Practice","price":" Rs. 392 "}];
arr3 = [{"link":"#","prod":"Fundamentals Of Software Engineering","price":" Rs. 203 "},{"link":"##","prod":"Real-Time Systems: Theory And Practice","price":" Rs. 394 "}] ;
var mergedArray = arr1.concat(arr2, arr3);
var sorted = mergedArray.sort(function(a, b){
 var priceA = parseFloat(a.price.replace("Rs.", ""));
 var priceB = parseFloat(b.price.replace("Rs.", ""));
 return priceA - priceB;
});
console.log(sorted);

References:
Stackoverflow question: http://stackoverflow.com/questions/8869123/adding-two-json-objects-and-sorting
jsfiddle http://jsfiddle.net/diode/FzzHz/

pornzrus – HTML5 Video Player like YouTube in jQuery plugin

Well, as you might know porn industry is sometimes associated to HUGE revolutions on media…

On the search for articles about HTML5 responsive video players I’v found this free video player from pornzrus.com.
This is a 100% copy past from their article.

Continue reading pornzrus – HTML5 Video Player like YouTube in jQuery plugin