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
#!/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