Skip to content

Instantly share code, notes, and snippets.

Ryosuke whoisryosuke

Block or report user

Report or block whoisryosuke

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
  1. Clone forked repo
  2. Checkout the master branch (or whichever branch you wanted to update)
  3. Add the original repo as an upstream: git remote add upstream git-url-here.git
  4. git fetch upstream
  5. git merge upstream/master
whoisryosuke /
Created Oct 21, 2019
PHP - Get number of "working" days in month (in this case, skips Sunday and Saturday or 0 and 6) -- via:
function countDays($year, $month, $ignore) {
    $count = 0;
    $counter = mktime(0, 0, 0, $month, 1, $year);
    while (date("n", $counter) == $month) {
        if (in_array(date("w", $counter), $ignore) == false) {
        $counter = strtotime("+1 day", $counter);
whoisryosuke /
Created Oct 21, 2019
PHP - Get number of "workingdays in month (in this case, working days
function countDays($year, $month, $ignore) {
    $count = 0;
    $counter = mktime(0, 0, 0, $month, 1, $year);
    while (date("n", $counter) == $month) {
        if (in_array(date("w", $counter), $ignore) == false) {
        $counter = strtotime("+1 day", $counter);
whoisryosuke / webpack.config.js
Last active Oct 11, 2019
Storybook / Webpack - How to add relative aliasing (@component/Button vs '../../component/Button`)
View webpack.config.js
const path = require('path')
module.exports = ({ config, mode }) => {
// Adds absolute paths to imports
config.resolve.alias = {
'@components': path.resolve(__dirname, '../src/components'),
'@assets': path.resolve(__dirname, '../src/assets'),
'@helpers': path.resolve(__dirname, '../src/helpers'),
whoisryosuke / gist:24ae29a059c96460371d70b97cee3c2d
Created Oct 10, 2019
React / JS - Mobile sidebar - detects if window size is mobile (600px) and tracks sidebar visibility independently
View gist:24ae29a059c96460371d70b97cee3c2d
import React, { useState, useEffect } from 'react'
import Header from './Header'
import debounce from '../../helpers/debounce'
const MobileHeader = () => {
const [isMobile, setMobile] = useState(false)
const [isVisible, setVisibility] = useState(false)
const resize = () => {
View config.js
// 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() {
View tsconfig.json
"compilerOptions": {
"outDir": "./dist/",
"sourceMap": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"allowJs": true,
"forceConsistentCasingInFileNames": true,
whoisryosuke / gatsby-node.js
Created Sep 30, 2019
Webpack / React / Gatsby - Alias components directory (and others) instead of relative modules (`../../../components?/button`) - via:
View gatsby-node.js
const path = require('path');
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
exports.onCreateWebpackConfig = ({ config, actions }) => {
plugins: [
new ForkTsCheckerWebpackPlugin({
checkSyntacticErrors: true,
formatter: 'codeframe',
tslint: './tslint.json',
whoisryosuke / theme.js
Created Sep 22, 2019
CSS in JS / Styled Components / Emotion - Theming file with colors, typography, borders, and 16-col grid (based on Semantic UI)
View theme.js
import Color from "tinycolor2";
* Creates column percentages based on column count
const createColumns = columnCount => {
const columns = {};
for (let i = 1; i <= columnCount; i += 1) {
columns[i] = `${(i / columnCount) * 100}%`;
whoisryosuke /
Created Sep 17, 2019 — forked from santisbon/
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

You can’t perform that action at this time.