Skip to content

Instantly share code, notes, and snippets.

View ThadeuLuz's full-sized avatar
Working

Thadeu Luz ThadeuLuz

Working
View GitHub Profile
@ThadeuLuz
ThadeuLuz / Counter.js
Last active December 27, 2019 12:52
Example HOC for unstated
import React from 'react';
import { inject } from 'unstated';
import CounterContainer from './CounterContainer.js';
const Counter = ({ counter }) => (
<div>
<button onClick={() => counter.decrement()}>-</button>
<span>{counter.state.count}</span>
<button onClick={() => counter.increment()}>+</button>
</div>
@ThadeuLuz
ThadeuLuz / tests.json
Created September 27, 2017 11:49
A better stack for your Firebase Rules - Targaryen tests
{
"root": {
"users": {
"RICK": {
"displayName": "Rick Sanchez",
"age": 60
},
"MORTY": {
"displayName": "Morty Smith",
"age": 14
@ThadeuLuz
ThadeuLuz / rules.json
Created September 26, 2017 20:58
A better stack for your Firebase Rules - Compiled Rules
{
"rules": {
"users": {
".read": "auth != null && auth.uid == 'SERVER'",
"$userId": {
".validate": "newData.hasChildren(['displayName', 'age'])",
"displayName": {
".validate": "newData.isString()"
},
"age": {
@ThadeuLuz
ThadeuLuz / rules.bolt
Created September 26, 2017 20:45
A better stack for your Firebase Rules - Bolt example
// Indicates if a user is logged in
imLoggedIn() {
auth != null
}
// Checks for the correc user id
myUidIs(uid) {
imLoggedIn() && auth.uid == uid
}
@ThadeuLuz
ThadeuLuz / Simple Firebase Rules Stack.md
Last active September 26, 2017 20:37
Firebase Rules Example (Bolt + Targaryen)

#Simple Firebase Rules Stack

@ThadeuLuz
ThadeuLuz / index.js
Created September 23, 2017 18:30
Simple Firebase and cli integration
// Lembre de rodar: npm i firebase
const firebase = require("firebase");
const exec = require("child_process").exec;
var config = {
// Sua configuração do firebase
};
const firebaseApp = firebase.initializeApp(config);
const ref = firebaseApp.database().ref();
@ThadeuLuz
ThadeuLuz / Dialog.jsx
Last active July 4, 2018 21:59
This is a fix of several problems I had when using the vanilla Material-ui Dialog like using javascript for height, lack of full screen for mobile, having to choose the body scroll visibility regardless of screen/content size and the body scroll position in some browsers. Tested on latest chrome and safari only. Please let me know if you think i…
import React, { PropTypes } from 'react';
import MDialog from 'material-ui/Dialog';
import './dialog.css';
const Dialog = props => (
<MDialog
{...props}
repositionOnUpdate={false}
autoDetectWindowHeight={false}
@ThadeuLuz
ThadeuLuz / dddsBrasileiros.json
Last active November 19, 2024 20:05
Objeto JSON com Estados Brasileiros por DDD e lista de DDDs por Estados.
{
"estadoPorDdd": {
"11": "SP",
"12": "SP",
"13": "SP",
"14": "SP",
"15": "SP",
"16": "SP",
"17": "SP",
"18": "SP",
@ThadeuLuz
ThadeuLuz / mdStyleColor.js
Last active March 17, 2016 05:13
Trying to add more flexibility to elements css in angular-material
(function () {
"use strict";
var _theme;
angular
.module('mdColors',['mdColors'])
.config(['$mdThemingProvider', function($mdThemingProvider){
_theme = $mdThemingProvider.theme();