Skip to content

Instantly share code, notes, and snippets.

View ryonakae's full-sized avatar
🙄

Ryo Nakae ryonakae

🙄
View GitHub Profile
@ryonakae
ryonakae / AppleScript
Last active March 26, 2024 07:58
MacのAutomatorを使ってGoogle Chromeのユーザープロファイル別のショートカットを作る方法
tell application "Google Chrome" to activate
tell application "System Events"
tell process "Google Chrome"
click menu item "プロファイル名" of menu 1 of menu bar item "プロファイル" of menu bar 1
end tell
end tell
@ryonakae
ryonakae / tailwind.config.ts
Last active December 22, 2023 03:38
Tailwind CSSのデフォルトの変数をほぼ全て削除して、なるべくArbitrary valuesを使うためのtailwind.config
import type { Config } from 'tailwindcss'
const config: Config = {
content: ['./src/**/*.{js,ts,jsx,tsx,mdx}'],
theme: {
// Common
colors: {
'[]': '[]',
inherit: 'inherit',
transparent: 'transparent',
@ryonakae
ryonakae / useTumblrAuthentication.ts
Last active July 27, 2023 06:13
TmblrにOAuth 1.0aでログインするCustom Hook (React Native + Expo)
import * as AuthSession from 'expo-auth-session'
import Constants from 'expo-constants'
import * as WebBrowser from 'expo-web-browser'
import qs from 'qs'
import hmacsha1 from 'hmacsha1'
const consumerKey = Constants.expoConfig?.extra?.oauthConsumerKey
const consumerSecret = Constants.expoConfig?.extra?.oauthConsumerSecret
@ryonakae
ryonakae / Heading.tsx
Last active April 8, 2022 02:25
Custom Polymorphic Component by Framer Motion with TypeScript
import { HTMLMotionProps, motion } from 'framer-motion'
import { forwardRef, ReactNode } from 'react'
type HeadingTags = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'
type HeadingProps = {
as: HeadingTags
children: ReactNode
}
const CustomTagComponent = forwardRef<HTMLHeadingElement, HeadingProps>(
@ryonakae
ryonakae / index.js
Created February 7, 2022 07:38
Apply auto-layout for multiple frames on Figma
const layoutMode = 'HORIZONTAL' // 'HORIZONTAL' or 'VERTICAL'
figma.currentPage.selection.forEach(node => {
if (node.type === 'FRAME') {
const firstItemPosition = layoutMode === 'HORIZONTAL' ? node.children[0].x : node.children[0].y
const firstItemSize = layoutMode === 'HORIZONTAL' ? node.children[0].width : node.children[0].height
const secondItemPosition = layoutMode === 'HORIZONTAL' ? node.children[1].x : node.children[1].y
const itemSpacing = secondItemPosition - (firstItemPosition + firstItemSize)
node.layoutMode = layoutMode
node.itemSpacing = itemSpacing
@ryonakae
ryonakae / HStack.tsx
Last active January 4, 2022 14:58
HStack / VStack / Spacer component on React Native
import React from 'react'
import { StyleSheet, StyleProp, ViewStyle, View, FlexAlignType, ViewProps } from 'react-native'
type HStackProps = ViewProps & {
align?: FlexAlignType
style?: StyleProp<ViewStyle>
}
const HStack: React.FC<HStackProps> = ({ align = 'stretch', style, children, ...delegated }) => {
return (
@ryonakae
ryonakae / left_ctrl_and_apace_to_enter.json
Created December 29, 2021 05:23
Karabiner-Elementsで左Ctrl + SpaceをEnterにする
{
"title": "Left Control + Spacebar to Enter",
"rules": [
{
"description": "Left Control + Spacebar to Enter",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "spacebar",
@ryonakae
ryonakae / bookmarklet.js
Last active June 2, 2023 05:12
Twitterの興味関心 (https://twitter.com/settings/your_twitter_data/twitter_interests) のチェックをすべて外すブックマークレット
javascript:(function(){var%20href_pc="https://twitter.com/settings/your_twitter_data/twitter_interests";var%20href_mobile="https://mobile.twitter.com/settings/your_twitter_data/twitter_interests";if(location.href!==href_pc&&location.href!==href_mobile){return%20location.href=href_pc;}var%20inputArray=[];var%20timer=0;var%20count=0;document.querySelector("main").querySelectorAll('input[type="checkbox"][checked]').forEach(function(input){inputArray.push(input);});window.addEventListener("error",function(error){clearInterval(timer);alert("エラーが発生したため中断しました");});timer=setInterval(function(){var%20input=inputArray[count];var%20label=input.closest("label");var%20offsetTop=input.getBoundingClientRect().top+window.scrollY-100;window.scrollTo(0,offsetTop);label.dispatchEvent(new%20MouseEvent("click"));count++;if(count===inputArray.length){clearInterval(timer);alert("すべてのチェックを外しました");}},3000);})();
blendModes = {
/* eslint-disable @typescript-eslint/naming-convention */
ADD: PIXI.BLEND_MODES.ADD,
ADD_NPM: PIXI.BLEND_MODES.ADD_NPM,
COLOR: PIXI.BLEND_MODES.COLOR,
COLOR_BURN: PIXI.BLEND_MODES.COLOR_BURN,
COLOR_DODGE: PIXI.BLEND_MODES.COLOR_DODGE,
DARKEN: PIXI.BLEND_MODES.DARKEN,
DIFFERENCE: PIXI.BLEND_MODES.DIFFERENCE,
DST_ATOP: PIXI.BLEND_MODES.DST_ATOP,
@ryonakae
ryonakae / 2019100601.json
Last active October 6, 2019 15:22
My Rules of Karabiner-Elements Complex Modifications
{
"title": "My Rules",
"rules": [
{
"description": "Change grave to esc / fn+grave to backslash / backslash to grave",
"manipulators": [
{ "_comment": "graveをescにする" },
{
"type": "basic",
"from": {