git verbose pull
To get a more verbose output when doing a pull, you can have this:
GIT_CURL_VERBOSE=1 GIT_TRACE=1 git pull
access google+ API from node.js
Steps:
- enable Google+ API in google console
- create credentials for
1
Web Application
- here’s the code snippet I used to obtain the code:
- I’m using
for node in this example, and I had the values for client_id, client_secret, and the redirect url mentioned there.1
dotenv
- at some point, the application will show the URL in the console, copy it and visit it in your browser
- google will redirect to your registered application URL with a
parameter. Write that down, paste it, and press enter. For this purpose, I had a rails app running in the background, with a1
code
so that I could inspect what’s sent as1
binding.pry
.1
params
- you will then see in the console the access_token, refresh_token and expiry_date. Those you can use when you make the API calls.
gunzip without overwriting interactively
This will keep the archive after decompressing, and in case a file already exists, instead of seeing the prompt with
,
1
do you with to overwrite
will instead be sent. Found solution here1
n
yes n | gzip -v -dk *.gz
ruby can't dump hash with default proc
Received the error ruby can’t dump hash with default proc. It was raised by a 3rd party lib, that was using
.
Turns out, I had a hash defined like this:1
Marshal.dump
The fix was to remove the initialization block, and instead use it like this in my code:
postgresql installed via homebrew that won't start
After a reboot, postgresql wouldn’t start. Tried
and still nothing.
Checked the /usr/local/var/postgres/server.log and it was complaining about /usr/local/var/postgres/postmaster.pid.
My first thought was to delete it, but I ran a google search before. Luckily, I found this link where
it clearly says that deleting the pid file is not recommended. So, I ran a cat command and found the PID ( it’s the first line in the file ),
and did a kill -9 PID. After that, running again brew services postgresql restart worked, and PG booted.1
brew services restart postgresql
run custom jquery in ember route
Needed to initialize some jquery elements in a route. This provided the answer:
find empty json objects in postgres
Say you have a content column of type json, which holds arrays, and you want to delete the empty ones:
select * from events where content::text = '[]'::text;
ember check if model settled before displaying
If you have a model with relationships, the
property could be of some use, to avoid drawing only partial state, in case of ajax,
or even screen flickering:1
isSettled
Display some data here Loading ...