Skip to content

Instantly share code, notes, and snippets.

Valid Cards
4242424242424242 Visa
4012888888881881 Visa
5555555555554444 MasterCard
5105105105105100 MasterCard
378282246310005 American Express
371449635398431 American Express
6011111111111117 Discover
6011000990139424 Discover
30569309025904 Diner's Club
@dprabu17
dprabu17 / ImageViewer.tsx
Created May 29, 2019 09:59 — forked from ospfranco/ImageViewer.tsx
Component that correctly rotates an image based on EXIF data
import * as React from 'react';
import * as Reactdom from 'react-dom';
import * as loadimage from 'blueimp-load-image';
class ImageViewer extends React.Component<any, any> {
private imageCanvas;
public componentDidMount() {
loadimage('IMAGE_URL', (img) => {
img.className = 'fit_to_parent'; // css class: { max-width: 100%; max-height: 100%; }
Reactdom.findDOMNode(this.imageCanvas).appendChild(img);
pg_dump -F c -h localhost -U pg_user -d db_name | gzip -c > sql_dump.gz
#-F format c -> custom
#Restore
pg_restore -U username -d db_name -v dumpfile_location -h localhost
@dprabu17
dprabu17 / modern_js.md
Created November 6, 2018 18:08 — forked from gaearon/modern_js.md
Modern JavaScript in React Documentation

If you haven’t worked with JavaScript in the last few years, these three points should give you enough knowledge to feel comfortable reading the React documentation:

  • We define variables with let and const statements. For the purposes of the React documentation, you can consider them equivalent to var.
  • We use the class keyword to define JavaScript classes. There are two things worth remembering about them. Firstly, unlike with objects, you don't need to put commas between class method definitions. Secondly, unlike many other languages with classes, in JavaScript the value of this in a method [depends on how it is called](https://developer.mozilla.org/en-US/docs/Web/Jav
# Welcome to the spritle laptop script!
echo_display() {
printf "\n%b\n" "$1"
}
echo_display "Welcome to Spritle laptop init script!"
echo_display "We are going to prepare an awesome development machine for you. \n Lets begin."
echo_display "Updating system packages ..."
if command -v aptitude >/dev/null; then
source 'https://rubygems.org'
gem 'rails', '4.2.3'
gem 'pg', '0.18.2'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'compass-rails'
gem 'coffee-rails', '~> 4.1.0'
# Use jquery as the JavaScript library
gem 'jquery-rails'
#!/usr/bin/env ruby
# Mails a file using GMail's SMTP Server.
# For illustrative purposes; error checking and testing intentionally omitted for brevity.
#
# Requirements:
# 1) the 'mail' gem must be installed
# 2) a file named 'pw.txt' containing the Google password must be present
# in the current directory.
#
# Ruby versions: tested on 1.9.3, 1.8.7, JRuby
@dprabu17
dprabu17 / heroku
Created April 18, 2014 07:05
Heroku
Heroku
install
https://toolbelt.heroku.com/
heroku create
heroku run rake assets:clean
heroku run rake assets:precompile
git push heroku master
git push heroku branch:master
heroku apps:rename rails3-deployments
@dprabu17
dprabu17 / git-deploy
Created April 17, 2014 18:47
git-deploy
https://github.com/mislav/git-deploy
gem install git-deploy
1. Create a git remote for where you'll push the code on your server.
git remote add production "root@188.226.210.218:/home/webapps/www/git-deploy"
2. This will initialize the remote git repository in the deploy directory
git deploy setup -r "production"
3.This generates default deploy callback scripts
#require 'capistrano/ext/multistage'
require "rvm/capistrano"
require "bundler/capistrano"
set :application, "set your application name here"
set :rails_env, 'production'
set :rvm_type, :system
set :scm, :git # You can set :scm explicitly or Capistrano will make an intelligent guess based on known version control directory names # Or: `accurev`, `bzr`, `cvs`, `darcs`, `git`, `mercurial`, `perforce`, `subversion` or `none`
set :copy_exclude, [ '.git' ]