Skip to content

Instantly share code, notes, and snippets.

Adding Google Sign In With Rails and React

For this blog post we will be using ruby version 2.4.0 and rails version 5.1.4 as backend and React/Redux as frontend. Adding Google Sign in functionality in your application can be done in two popular ways.

  • Adding google sign in functionality in the frontend with google api client gapi.

  • Adding google sign in functionality logic in the backend server.

If your application has separate backendend with APIs feeding data to the frontend React application, I suggest you to follow the step 2. If you want yo enhance your application security, then you implement both.

@pcreux
pcreux / postgres-is-not-happy.md
Created May 1, 2014 22:49
Repair postgres (homebrew) after a system crash

When my mac crashes and Postgres doesn't boot properly I see the following errors in /usr/local/var/postgres/server.log

FATAL:  lock file "postmaster.pid" already exists

# and / or

lock file "/var/pgsql_socket/.s.PGSQL.5432.lock" already exists

Here are the commands to put Postgres back on track:

@kidbrax
kidbrax / point-in-polygon.rb
Created September 22, 2011 22:43
Check whether a point is within a polygon #ruby
def point_in_polygon?(polygonPoints)
return false if self.latitude.blank? or self.longitude.blank?
polygonPoints.each do |point|
point[0] = point[0].to_f
point[1] = point[1].to_f
end
contains_point = false
i = -1
j = polygonPoints.size - 1