Skip to content

Instantly share code, notes, and snippets.

View tcodes0's full-sized avatar
💭
What's happening?

Thomazella Ribeiro tcodes0

💭
What's happening?
View GitHub Profile
## iOS emphasis
We'll be focusing on getting the ins and outs of iOS apps because that's what we do better.
## The simulator
The simulator is the development tool we use to simulate an iPhone.
### What you should know:
@tcodes0
tcodes0 / quit-work.sh
Last active January 26, 2019 02:23
quit working
#! /usr/bin/env bash
# quit working
osascript -e 'quit app "React Native Debugger"' 2>/dev/null
osascript -e 'quit app "Terminal"'
osascript -e 'quit app "iTunes"'
osascript -e 'quit app "Simulator"'
osascript -e 'quit app "Xcode"'
osascript -e 'quit app "Slack"'
osascript -e 'quit app "Google Chrome"'
// Place your key bindings in this file to overwrite the defaults
[
{
"key": "alt+tab",
"command": "editor.action.reindentlines",
"when": "editorTextFocus && !editorReadonly"
},
{
"key": "alt+;",
"command": "editor.action.commentLine",
import throttle from 'lodash/throttle';
import { useRef, useEffect, useCallback } from 'react';
export default function useThrottle(func, time = 1000) {
const throttleRef = useRef();
const callbackRef = useRef();
useEffect(() => {
callbackRef.current = func;
}, [func]);
@tcodes0
tcodes0 / lazy git
Last active August 19, 2019 18:07
lazy git function with commilint style messages
#! /usr/bin/env bash
# LAZY GIT
# with commitlint automation. Does git add --all and builds commit message:
# lg foo bar -> chore(misc): foo bar
# lg chore bar -> chore(misc): bar
# lg chore app: fix stuff -> chore(app): fix stuff
lg() {
local args="$*"
local commitTypes=(build ci chore docs feat fix perf refactor revert style test)
#!/usr/bin/env bash
# packager
adb reverse tcp:8081 tcp:8081
adb -d reverse tcp:8081 tcp:8081
adb -e reverse tcp:8081 tcp:8081
echo "🚧 React Native Packager Redirected 🚧"
@tcodes0
tcodes0 / gist:0d65057f6bf58164487c0fd9413bb5ef
Created September 6, 2019 13:39
debug jest test node vscode
// configurations is an array of objects
// add the object, select "Jest Tests" in debugger GUI (on the top left), add a breakpoint and hit F5! :rocket:
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Jest Tests",
"program": "${workspaceRoot}/node_modules/jest/bin/jest.js",
"args": ["-i"],
@tcodes0
tcodes0 / fetch-error.js
Created September 8, 2019 17:59
fetch-error-treatment
const fetchPayloadFrom = async response => {
if (response.status >= 200 && response.status < 300) {
const json = await response.json();
return json;
} else {
const bodyResp = await response.text();
const error = new Error(bodyResp);
error.status = response.status;
error.statusText = response.statusText;
throw error;
@tcodes0
tcodes0 / testnet
Created September 11, 2019 16:07
testnet
androidgreen
5JFJJ53VqsZVDf9qUBAooPN8ReTkFbJXLUmizSrcjEnRgjEjTBF
teamwinncake
5JjzRvrYN3kDDK5FuS1vX5UdJFgtkrvNQdkscP6UgfQLjn6EmNB
mynewtestnet
5Jvvzhxtocmg3Xh1bB25ex4smGHnzmDsjXy46bdD1aFrfMHYhcM
@tcodes0
tcodes0 / saga-test.js
Created September 17, 2019 19:58
redux saga tests with redux-saga-test-plan
import loginSaga from '../Set';
import { expectSaga } from 'redux-saga-test-plan';
import yourFunction from '../../../Containers/YourFuncionHere';
global.fetch = require('jest-fetch-mock');
beforeEach(() => {
fetch.resetMocks();
});