Skip to content

Instantly share code, notes, and snippets.

@ryonakae
ryonakae / config.h
Created March 17, 2019 13:10
ErgoDash mini Keymap
/*
This is the c configuration file for the keymap
Copyright 2012 Jun Wako <[email protected]>
Copyright 2015 Jack Humbert
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
@ryonakae
ryonakae / chromaticAberrationFilter.frag
Created June 20, 2019 09:37
PixiJS chromatic aberration filter
precision mediump float;
varying vec2 vTextureCoord;
uniform sampler2D uSampler;
uniform vec2 uResolution; // app.screen
uniform vec2 uMouse; // -1.0 ~ 1.0
uniform vec2 uRed;
uniform vec2 uGreen;
uniform vec2 uBlue;
@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": {
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 / 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);})();
@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 / 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 / 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 / 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 / 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