Skip to content

Instantly share code, notes, and snippets.

:shipit:
*tec tec tec noises*

Gabriel Rohden Grohden

:shipit:
*tec tec tec noises*
Block or report user

Report or block Grohden

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Grohden
Grohden / convert-taps.js
Created Sep 12, 2019
After reading the android monkey sources, i came up with this: a way to make a monkey runner "script" by hand
View convert-taps.js
// Let's suppose you have this in adb:
const adbCommands = `input tap 450 450
input tap 740 280
input tap 683 614
input tap 950 411
input tap 1188 248
input tap 915 713
input tap 1176 560
input tap 1428 358
input tap 1149 789
@Grohden
Grohden / pick-keys-by-type.ts
Created Aug 9, 2019
Utility type to pick keys by type
View pick-keys-by-type.ts
export type Primitive = string | number | boolean | bigint | symbol | undefined | null;
export type PickKeysDeep<T, P = any> = {
[K in keyof T]: T[K] extends object
? P extends Primitive
? PickKeysDeep<T[K], P>
: K | PickKeysDeep<T[K], P>
: P extends Primitive
? P extends T[K]
? K
@Grohden
Grohden / deep-typename-apollo.ts
Created Aug 9, 2019
Fn to put deep __typename based on keys for apollo gql (apollo link rest is too verbose)
View deep-typename-apollo.ts
/*
* This is micro optimized, you could
* do it without mutability, but I think
* that this is to solve a very specific case (apollo
* requires __typename to be injected)
*/
function addTypeNames(
item: object,
typeNames: object
) {
@Grohden
Grohden / example-json-model.json
Last active Jun 28, 2019
Generate dart deserialization and model classes based on JSON input
View example-json-model.json
{
"pageCount": 1,
"result": [
{
"page_number": 12,
"is_favorite": true,
"cover": {
"width": 40,
"height": 50,
"url": "www.test.com"
@Grohden
Grohden / Lightbox.tsx
Created Jun 24, 2019
Just saving this refactor of the lightbox
View Lightbox.tsx
import React, {
Children,
cloneElement, FC, useRef, useState
} from 'react'
import {
Animated,
TouchableHighlight,
View,
ViewStyle
} from 'react-native'
@Grohden
Grohden / AutoHeightRBSheet.tsx
Last active May 27, 2019
React native raw bottom sheet with auto height calcs
View AutoHeightRBSheet.tsx
// This is basically a copy of
// https://github.com/nysamnang/react-native-raw-bottom-sheet
// but using only translate animations instead of height
import React, {
forwardRef, ReactNode,
RefForwardingComponent,
useImperativeHandle,
useState
} from 'react'
@Grohden
Grohden / App.js
Last active May 22, 2019
React navigation + react hooks problem with callback param
View App.js
import React from 'react';
import {
createAppContainer,
createStackNavigator
} from 'react-navigation'
import TestScreen, {
testScreenOptions
} from './TestScreen'
const stack = createStackNavigator({
@Grohden
Grohden / make-revision-file.js
Created May 16, 2019
NodeJs script to read two specific files for translation and write them together for better revision
View make-revision-file.js
const fs = require('fs');
const english = require("./english.json").text
const portuguese = require("./portuguese.json").text
const DEFAULT_KEY = "en-US"
const accumlator = {}
// Acc the english ones
english.reduce((all, value) => {
all[value.key] = {
@Grohden
Grohden / test.ts
Last active May 7, 2019
My try on dependent types + conditional types using typescript to validate optional args based on a key
View test.ts
type Routes = {
a: {
string: string
}
b: undefined
}
type NullableKeys<T, K extends keyof T> = T[K] extends null | undefined
? K
View marcelo_php.md

Desvantagens

  • Tempos de build e testes
  • Tamanho do repositório (tempo de checkout)
  • Nescessidade de tooling dedicado
  • Tendencia a aumentar o acoplamento entre as dependências

Vantagens

You can’t perform that action at this time.