Skip to content

Instantly share code, notes, and snippets.


Sators sators

View GitHub Profile
jrapala / normalize.ts
Last active Jun 11, 2020
Normalize React Native font sizes
View normalize.ts
// How to use:
// StyleSheet or inline styles:
// fontSize: normalize(15),
// styled-components:
// font-size: ${normalize(15) + "px"};
import { Dimensions, Platform, PixelRatio } from "react-native"
plindberg /
Created Aug 5, 2017
How to set up an AWS Lambda function for returning S3 pre-signed URLs for uploading files.


Granted, this is little more than an obfuscated way of having a publicly writable S3 bucket, but if you don’t have a server which can pre-sign URLs for you, this might be an acceptable solution.

For this to work, you take the following steps:

  1. Create a Lambda func, along with a new IAM role, keeping the default code.
  2. Create an API in the API Gateway.
nrollr /
Last active Feb 24, 2021
Install Node.js on Amazon Linux (EC2)

Installing Node.js on Amazon Linux AMI

The following will guide you through the process of installing Node.js on an AWS EC2 instance running Amazon Linux AMI 2016.09 - Release Notes

For this process I'll be using a t2.micro EC2 instance running Amazon Linux AMI (ami-d41d58a7). Once the EC2 instance is up-and-running, connect to your server via ssh

benhodgson87 / decimalFormat.js
Last active Nov 8, 2020
DecimalFormat Currency Formatting
View decimalFormat.js
Number.prototype.currency = function (format) {
var amt = this, neg;
// If no formatting string supplied
// or amount is not a number, return as is
if (!format || isNaN(amt)) return amt;
// Extract placeholders from format string
var formFig = format.match(/\#(.*)\#/g).pop();
oodavid /
Created Mar 26, 2012
Backup MySQL to Amazon S3

Backup MySQL to Amazon S3

This is a simple way to backup your MySQL tables to Amazon S3 for a nightly backup - this is all to be done on your server :-)

Sister Document - Restore MySQL from Amazon S3 - read that next

1 - Install s3cmd

this is for Centos 5.6, see for other systems like ubuntu etc