Skip to content

Instantly share code, notes, and snippets.

Nitin Hayaran nitinhayaran

View GitHub Profile
@nitinhayaran
nitinhayaran / restore.md
Created Dec 22, 2017
How to restore specific tables on heroku from backup
View restore.md

How to restore specific tables on heroku from backup

  1. Create a new database instance attached to current application
  2. Restore latest database backup on newly created database
  3. Get the connection url of this backup database. Use this URL in later sql queries.
  4. Connect to database where we have incorrect data
heroku pg:psql --app ck-api-prod
  1. On postgres prompt run following queries. This will create copy table from data in backup database.
@nitinhayaran
nitinhayaran / s3-bucket-move
Created Mar 16, 2017 — forked from alanwill/s3-bucket-move
Move an S3 bucket to a different region
View s3-bucket-move
aws s3 sync s3://oldbucket s3://newbucket --source-region us-west-1 --region us-west-2
View gist:e8fe703f79a9da4a5fe5
heroku pg:backups capture --app sushi
curl -o latest.dump `heroku pg:backups public-url --app sushi`
pg_restore --verbose --clean --no-acl --no-owner -j 8 [-U user_name] -d database_name latest.dump
# To copy prodcution data to staging app
heroku pg:backups restore `heroku pgbackups:url -a production-app` DATABASE -a staging-app
# Store prodcution data to staging
heroku pg:backups restore `heroku pgbackups:url -a production-app` DATABASE -a staging-app
heroku pg:backups restore b001 DATABASE_URL --app sushi
View gist:bef2f17011a5697cbca3
Verifying that +nitinh is my Bitcoin username. You can send me #bitcoin here: https://onename.io/nitinh
@nitinhayaran
nitinhayaran / detectFiles.js
Created Jul 18, 2014
Test if dragenter/dragover event contains files
View detectFiles.js
function containsFiles(event) {
if (event.dataTransfer.types) {
for (var i = 0; i < event.dataTransfer.types.length; i++) {
if (event.dataTransfer.types[i] == "Files") {
return true;
}
}
}
return false;
}
@nitinhayaran
nitinhayaran / flickr_urls
Last active Apr 23, 2020
Flickr Photo urls size suffixes along with url returned from apis
View flickr_urls
url_sq : s small square 75x75
url_q : q large square 150x150
url_t : t thumbnail, 100 on longest side
url_s : m small, 240 on longest side
url_n : n small, 320 on longest side
url_m : - medium, 500 on longest side
url_z : z medium 640, 640 on longest side
url_c : c medium 800, 800 on longest side†
url_l : b large, 1024 on longest side*
url_o : o original image, either a jpg, gif or png, depending on source format
@nitinhayaran
nitinhayaran / css_resources.md
Created Jun 4, 2014 — forked from jookyboi/css_resources.md
CSS libraries and guides to bring some order to the chaos.
View css_resources.md

Libraries

  • 960 Grid System - An effort to streamline web development workflow by providing commonly used dimensions, based on a width of 960 pixels. There are two variants: 12 and 16 columns, which can be used separately or in tandem.
  • Compass - Open source CSS Authoring Framework.
  • Bootstrap - Sleek, intuitive, and powerful mobile first front-end framework for faster and easier web development.
  • Font Awesome - The iconic font designed for Bootstrap.
  • Zurb Foundation - Framework for writing responsive web sites.
  • SASS - CSS extension language which allows variables, mixins and rules nesting.
  • Skeleton - Boilerplate for responsive, mobile-friendly development.

Guides

@nitinhayaran
nitinhayaran / python_resources.md
Created Jun 4, 2014 — forked from jookyboi/python_resources.md
Python-related modules and guides.
View python_resources.md

Packages

  • lxml - Pythonic binding for the C libraries libxml2 and libxslt.
  • boto - Python interface to Amazon Web Services
  • Django - Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.
  • Fabric - Library and command-line tool for streamlining the use of SSH for application deployment or systems administration task.
  • PyMongo - Tools for working with MongoDB, and is the recommended way to work with MongoDB from Python.
  • Celery - Task queue to distribute work across threads or machines.
  • pytz - pytz brings the Olson tz database into Python. This library allows accurate and cross platform timezone calculations using Python 2.4 or higher.

Guides

@nitinhayaran
nitinhayaran / javascript_resources.md
Created Jun 4, 2014 — forked from jookyboi/javascript_resources.md
Here are a set of libraries, plugins and guides which may be useful to your Javascript coding.
View javascript_resources.md

Libraries

  • jQuery - The de-facto library for the modern age. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.
  • Backbone - Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
  • AngularJS - Conventions based MVC framework for HTML5 apps.
  • Underscore - Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects.
  • lawnchair - Key/value store adapter for indexdb, localStorage
@nitinhayaran
nitinhayaran / 0_reuse_code.js
Created Jun 4, 2014
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
You can’t perform that action at this time.