Skip to content

Instantly share code, notes, and snippets.

View n7best's full-sized avatar
🎯
I may be slow to respond.

n7best n7best

🎯
I may be slow to respond.
View GitHub Profile
@n7best
n7best / S3-CORS-config.xml
Created December 31, 2015 01:56 — forked from zxbodya/S3-CORS-config.xml
Client side uploads to s3, with pre-signed upload form (PHP/JS)
<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
<AllowedOrigin>*</AllowedOrigin>
<AllowedMethod>PUT</AllowedMethod>
<AllowedMethod>POST</AllowedMethod>
<AllowedMethod>GET</AllowedMethod>
<AllowedMethod>HEAD</AllowedMethod>
<MaxAgeSeconds>3000</MaxAgeSeconds>
<AllowedHeader>*</AllowedHeader>
@n7best
n7best / inc_id_rules.js
Created December 29, 2015 00:58 — forked from katowulf/inc_id_rules.js
Security rules for creating an incremental, numeric ID in Firebase
{
"rules": {
".read": true,
".write": false,
"incid": {
"counter": {
// this counter is set using a transaction and can only be incremented by 1
// the total number of records must be less than 10,000 simply for demo purposes
".write": "newData.isNumber() && ((!data.exists() && newData.val() === 1) || newData.val() === data.val()+1) && newData.val() <= 10000"
},