Skip to content

Instantly share code, notes, and snippets.

View whoisryosuke's full-sized avatar
👾
Going deep with game development

Ryosuke whoisryosuke

👾
Going deep with game development
View GitHub Profile
@whoisryosuke
whoisryosuke / component.tsx
Last active December 3, 2019 19:01 — forked from chrislopresto/component.tsx
styled-components v4 + createGlobalStyle + TypeScript definitions
import * as React from 'react';
import { theme } from './theme';
import { ThemeProvider, createGlobalStyle } from './styled-components';
const GlobalStyle = createGlobalStyle`
body {
font-family: Times New Roman;
}
`;
@whoisryosuke
whoisryosuke / visually-hidden.css
Created November 18, 2019 16:08 — forked from Andy-set-studio/visually-hidden.css
Visually hidden utility class
/**
* VISUALLY HIDDEN
* Hides element visually and removes it from the flow,
* but importantly, allows assitive technology to access it
*/
.visually-hidden {
border: 0;
clip: rect(0 0 0 0);
height: auto;
margin: 0;
// File: .storybook/config.js
import { configure, addDecorator } from '@kadira/storybook';
import Theme from './../src/ui/theme';
import React from 'react';
import { ThemeProvider } from 'styled-components'
function loadStories() {
require('../stories');
}
@whoisryosuke
whoisryosuke / Update-branch.md
Created September 17, 2019 17:38 — forked from santisbon/Update-branch.md
Bring your feature branch up to date with master. Deploying from Git branches adds flexibility. Bring your branch up to date with master and deploy it to make sure everything works. If everything looks good the branch can be merged. Otherwise, you can deploy your master branch to return production to its stable state.

Updating a feature branch

First we'll update your local master branch. Go to your local project and check out the branch you want to merge into (your local master branch)

$ git checkout master

Fetch the remote, bringing the branches and their commits from the remote repository. You can use the -p, --prune option to delete any remote-tracking references that no longer exist in the remote. Commits to master will be stored in a local branch, remotes/origin/master

@whoisryosuke
whoisryosuke / massInsertOrUpdate.php
Created June 18, 2019 20:00 — forked from RuGa/massInsertOrUpdate.php
Mass (bulk) insert or update on duplicate for Laravel 4/5
/**
* Mass (bulk) insert or update on duplicate for Laravel 4/5
*
* insertOrUpdate([
* ['id'=>1,'value'=>10],
* ['id'=>2,'value'=>60]
* ]);
*
*
* @param array $rows
import { useState, useEffect, useCallback } from 'react'
function usePromise(createPromise) {
const [error, setError] = useState()
const [value, setValue] = useState()
useEffect(() => {
let current = true
createPromise().then(
@whoisryosuke
whoisryosuke / clean.sh
Created May 12, 2019 06:07 — forked from zephraph/clean_node_modules.sh
Clean up node_modules
#!/bin/bash
DAYS_SINCE_LAST_CHANGE=14
SEARCH_PATH="./Git"
TOTAL_BYTES_REMOVED=0
Mb=1000000
Kb=1000
node_modules=$(find $SEARCH_PATH -name "node_modules" -type d -prune)
@whoisryosuke
whoisryosuke / error_blade_directive.php
Created April 5, 2019 18:54 — forked from calebporzio/error_blade_directive.php
A little Blade directive to make working with validation errors a bit nicer.
<?php
// Usage:
// Before
@if ($errors->has('email'))
<span>{{ $errors->first('email') }}</span>
@endif
// After:
const user2 = {
id: 200,
name: 'Vince Noir'
}
const user4 = {
id: 400,
name: 'Bollo',
quotes: ["I've got a bad feeling about this..."]
}
const noPassword = ({ password, ...rest }) => rest
const user = {
id: 100,
name: 'Howard Moon',
password: 'Password!'
}
noPassword(user) //=> { id: 100, name: 'Howard moon' }