Skip to content

Instantly share code, notes, and snippets.

Avatar
Working

Thadeu Luz ThadeuLuz

Working
View GitHub Profile
@ThadeuLuz
ThadeuLuz / Counter.js
Last active Dec 27, 2019
Example HOC for unstated
View Counter.js
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 Sep 27, 2017
A better stack for your Firebase Rules - Targaryen tests
View tests.json
{
"root": {
"users": {
"RICK": {
"displayName": "Rick Sanchez",
"age": 60
},
"MORTY": {
"displayName": "Morty Smith",
"age": 14
@ThadeuLuz
ThadeuLuz / rules.json
Created Sep 26, 2017
A better stack for your Firebase Rules - Compiled Rules
View rules.json
{
"rules": {
"users": {
".read": "auth != null && auth.uid == 'SERVER'",
"$userId": {
".validate": "newData.hasChildren(['displayName', 'age'])",
"displayName": {
".validate": "newData.isString()"
},
"age": {
@ThadeuLuz
ThadeuLuz / rules.bolt
Created Sep 26, 2017
A better stack for your Firebase Rules - Bolt example
View rules.bolt
// 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 Sep 26, 2017
Firebase Rules Example (Bolt + Targaryen)
View Simple Firebase Rules Stack.md

#Simple Firebase Rules Stack

@ThadeuLuz
ThadeuLuz / index.js
Created Sep 23, 2017
Simple Firebase and cli integration
View index.js
// 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 Jul 4, 2018
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…
View Dialog.jsx
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 Aug 2, 2020
Objeto JSON com Estados Brasileiros por DDD e lista de DDDs por Estados.
View dddsBrasileiros.json
{
"estadoPorDdd": {
"11": "SP",
"12": "SP",
"13": "SP",
"14": "SP",
"15": "SP",
"16": "SP",
"17": "SP",
"18": "SP",
@ThadeuLuz
ThadeuLuz / mdStyleColor.js
Last active Mar 17, 2016
Trying to add more flexibility to elements css in angular-material
View mdStyleColor.js
(function () {
"use strict";
var _theme;
angular
.module('mdColors',['mdColors'])
.config(['$mdThemingProvider', function($mdThemingProvider){
_theme = $mdThemingProvider.theme();
You can’t perform that action at this time.