Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Kay Gosho acro5piano

🏠
Working from home
View GitHub Profile
@acro5piano
acro5piano / navigations.ts
Created Jun 12, 2020
conditionally changes screen gestures in React Navigation
View navigations.ts
const Screens = {
Home: 'Home',
Settings: 'Settings',
}
const Navigation = createStackNavigator(
{
[Screens['Home']]: Home,
[Screens['Settings']]: Settings,
},
@acro5piano
acro5piano / README.md
Created Apr 7, 2020
Get Heroku all env vars
View README.md
  1. Open https://dashboard.heroku.com/apps/YOUR_APP/settings
  2. Click "Reveal Config Vars"
  3. Open JS console and paste the following code
[...document.getElementsByClassName('config-var-item')]
    .map(e => `${e.getElementsByTagName('input')[0].value}=${e.getElementsByTagName('textarea')[0].value}`)
    .join('\n')
@acro5piano
acro5piano / elixir.js
Last active Mar 27, 2020
pattern match in js
View elixir.js
// https://elixir-lang.org/getting-started/case-cond-and-if.html#case
function elixir(...conds) {
function arrayEqualsCond(a, b) {
if (a.length !== b.length) {
return false;
}
let eq = true;
for (let i = 0; i < a.length; i++) {
if (a[i] !== b[i] && !(b[i] instanceof Matcher)) {
View The error
* What went wrong:
Could not determine the dependencies of task ':app:mergeReleaseAssets'.
> Could not resolve all task dependencies for configuration ':app:releaseRuntimeClasspath'.
> Could not resolve io.repro:repro-android-sdk:+.
Required by:
project :app > project :react-native-repro
> Failed to list versions for io.repro:repro-android-sdk.
> Could not list versions using M2 pattern 'https://jitpack.io/[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier])(.[ext])'.
> Could not get resource 'https://jitpack.io/io/repro/repro-android-sdk/'.
> Could not GET 'https://jitpack.io/io/repro/repro-android-sdk/'. Received status code 522 from server: Origin Connection Time-out
View how_to_use_assert_module.js
'use strict';
const fs = require('fs');
const assert = require('assert').strict;
process.stdin.resume();
process.stdin.setEncoding('utf-8');
let inputString = '';
let currentLine = 0;
@acro5piano
acro5piano / file0.txt
Last active Dec 20, 2018
TypeScript の型定義から GraphQL のクエリを出力するライブラリを作った ref: https://qiita.com/acro5piano/items/602c4c042f01070204a7
View file0.txt
interface GetUserQueryData {
getUser: {
id: number
name: string
bankAccount: {
id: number
branch: string
}
}
}
View file0.txt
// NG
const Component = ({ onChange }) => (
<input onChange={e => onChange(e.target.value)} />
)
export default Component
@acro5piano
acro5piano / file0.txt
Last active Nov 27, 2018
pip install nkf できない時の対処法 ref: https://qiita.com/acro5piano/items/64c91bd67fe8c3ca559b
View file0.txt
(venv) [ec2-user@ip-172-55-55-55 tmp.szI1BtAgOR]$ pip install nkf
Collecting nkf
Cache entry deserialization failed, entry ignored
Could not find a version that satisfies the requirement nkf (from versions: )
No matching distribution found for nkf
@acro5piano
acro5piano / App.tsx
Created Oct 27, 2018
fetch data HOC with strongly typed
View App.tsx
import * as React from 'react'
import { get, WithData } from './decorator'
import * as moment from 'moment'
interface PostResponse {
id: number
userId: number
title: string
body: string
}
You can’t perform that action at this time.