Skip to content

Instantly share code, notes, and snippets.

View dhirajbajaj's full-sized avatar

Dhiraj Bajaj dhirajbajaj

View GitHub Profile
=== Query
curl -i -X GET \
"https://graph.facebook.com/v2.10/me?fields=id%2Cname%2Cbirthday%2Cemail%2Ceducation%2Cgender%2Cpicture%2Cfirst_name%2Clast_name%2Chometown%2Clocation%2Cverified%2Cwork%2Crelationship_status%2Creligion%2Cpolitical%2Clink%2Ccontext%2Cphotos&access_token=<access token sanitized>"
=== Access Token Info
{
"perms": [
"user_birthday",
"user_religion_politics",
"user_relationships",
"user_relationship_details",
@dhirajbajaj
dhirajbajaj / player.json
Created January 14, 2017 14:22
player.json
{
"responseCode": 200,
"responseMessage": "Players fetched successfully.",
"match_data": {
"id": 222,
"home_team_id": 3,
"away_team_id": 1,
"created_at": "2017-01-05T18:51:19.077+05:30",
"updated_at": "2017-01-05T18:51:19.077+05:30",
"start_time": "2017-01-19T09:30:00.000+05:30",
@dhirajbajaj
dhirajbajaj / gcloud_info
Created September 20, 2016 07:46
gcloud info
⚡ gcloud info
Google Cloud SDK [126.0.0]
Platform: [Mac OS X, x86_64]
Python Version: [2.7.10 (default, Jun 10 2015, 19:42:47) [GCC 4.2.1 Compatible Apple LLVM 6.1.0 (clang-602.0.53)]]
Python Location: [/usr/local/Cellar/python/2.7.10/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python]
Site Packages: [Disabled]
Installation Root: [/Users/dhirajbajaj/google-cloud-sdk]
Installed Components:
@dhirajbajaj
dhirajbajaj / successful-rails-nginx-production-deployment.txt
Created January 12, 2016 11:42 — forked from jimmypocock/successful-rails-nginx-production-deployment.txt
Ruby on Rails / Postgres / Nginx / Passenger / Capistrano / Ubuntu 14.04 / AWS
#####################################
# 0. SET UP AWS (ASSUMING YOU HAVE ALREADY SET UP AN ACCOUNT)
# CREATE SECURITY GROUP
• In the EC2 Dashboard, click Security Groups, then Create Security Group.
• Enter Name
• Enter Description
• Rules to add:
- HTTP
- SSH
# postgres upgrading from 9.3 to 9.4
brew switch postgres 9.3 # presuming you already installed 9.4.4
pg_dumpall > outputfile
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
mv /usr/local/var/postgres /usr/local/var/postgres.old
brew switch postgres 9.4.4
initdb -D /usr/local/var/postgres
psql -d postgres -f outputfile
[
{
"date"=>"Monday, June 01, 2015",
"slot"=>"15:00",
"agents_count"=>[
"agent13"
]
},
{
"date"=>"Monday, June 01, 2015",
@dhirajbajaj
dhirajbajaj / remove-multiple
Created June 11, 2015 13:05
Rails remove multiple columns except few
tbr_models = Model.column_names - ['id', 'name', ... , 'created_at', 'updated_at']
tbr_models.each do |model_column|
remove_column :models, model_column
puts "-- #{model_column}"
end
class @GoogleAnalytics
@load: ->
# Google Analytics depends on a global _gaq array. window is the global scope.
window._gaq = []
window._gaq.push ["_setAccount", GoogleAnalytics.analyticsId()]
# Create a script element and insert it in the DOM
ga = document.createElement("script")
ga.type = "text/javascript"
@dhirajbajaj
dhirajbajaj / app.js
Created August 26, 2014 20:35
TODO APP files
require('./db');
var express = require('express');
var path = require('path');
var favicon = require('static-favicon');
var logger = require('morgan');
var cookieParser = require('cookie-parser');
var bodyParser = require('body-parser');
var routes = require('./routes/index');