Gem::Ext::BuildError: ERROR: Failed to build gem native extension for the JSON gem

The dreaded Gem::Ext::BuildError: ERROR: Failed to build gem native extension has been in existence since I started dabbling with higher versions of rails.

Fetching gem metadata from https://rubygems.org/...........
Fetching rake 11.2.2
Installing rake 11.2.2
Using i18n 0.7.0
Fetching json 1.8.3
Installing json 1.8.3 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /Users/user/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/json-1.8.3/ext/json/ext/generator
/Users/user/.rbenv/versions/2.4.1/bin/ruby -r ./siteconf20170619-29262-1b1jy13.rb extconf.rb
creating Makefile

Remove the Gemfile.lock file

Removing the Gemfile.lock file lets your bundler do its work and find the compatible versions for your gems. Run bundler and you’ll have a nice install and have a new Gemfile.lock file.

Bundle complete! 51 Gemfile dependencies, 177 gems now installed.

Voila!

 Google Accounts: Sign out of all devices

Privacy and Security are a big issue these past few years. Numerous laws have been passed to secure our private life and lifestyle. Facebook makes it easy for you to logout out of all your devices and make sure you’re not logged into another’s device.

Google, however, doesn’t have this at the time of writing. A quick search will give you an answer to delete active sessions from the browser.

Delete Active Gmail active sessions:

  • Open Gmail on a computer and scroll to the very bottom of the page below all of your messages.
  • Click or tap the Details link on the bottom right. It’s right next to a sentence that reads “Last account activity:
  • Choose the Sign out all other web sessions button.

Although, there is one way but it will require you to compromise.

Logout of all devices logged in to Google Accounts

  • Change your password
  • This will prompt all other devices to ask you to login again

Voila!

 Git: Could not read from remote repository error

ERROR: Permission to user-coder/repo-name.git denied to your_username.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Permissions

Ask the repo owner if he has added you as a collaborator. If not, this is most likely your problem.

Invitations

A common error when collaborating with other users on Github. The most common way to fix this is to check for any invitations from the said repository. Accepting this invitation would ultimately fix your problem.

Zpmbif

 Javascript: Find an object by the value of a property

There are many reasons to look for objects by the value of one of its properties. Here’s a way:

const PLANS = [
  {
    id: 1,
    title: "Personal",
    billing_cycle: "Annual",
    amount: "$15",
    best_value: true,
    features: [
      "Lorem Ipsum sit amet dolor benefit here 1",
      "Lorem Ipsum sit amet dolor benefit here 2",
      "Lorem Ipsum sit amet dolor benefit here 3",
      "Lorem Ipsum sit amet dolor benefit here 4"
    ]
  },
  {
    id: 2,
    title: "Enterprise",
    billing_cycle: "Annual",
    amount: "$50",
    best_value: false,
    features: [
      "Lorem Ipsum sit amet dolor benefit here 1",
      "Lorem Ipsum sit amet dolor benefit here 2",
      "Lorem Ipsum sit amet dolor benefit here 3"
    ]
  }
];

ES6

let id ='1';
let selectedPlan = PLANS.find(plan => plan.id ===6);

UnderscoreJS

Option #1

var selectedPlan = _.findWhere(PLANS, {id: 6});

Option #2

var selectedPlan = _.find(PLANS, function (obj) {
  return obj.id === 6;
});