Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/ruby
# Replace linaria styled`` to vanilla-extract style({})
text = DATA.read
text.gsub!(%r|const (\w+) = styled.*?`(.*?)`|m) do
name = $1
css = $2
#!/usr/bin/ruby
# Replace linaria css`` to panda css({})
text = DATA.read
text.gsub!(%r|css`(.*?)`|m) do
css = $1
list = css.split(/;/).map do |s|
<HogeList>
<HogeList.Item title="ABC" />
<HogeList.Item title="DEF" />
</HogeList>
interface HogeListItemProps {
title: string;
}
const HogeListItem: React.VFC<HogeListItemProps> = ({title}) =>
<li>{title}</li>;
interface HogeListProps {
children: ReactNode;
}
@sunnyone
sunnyone / myproj.sh
Last active December 21, 2020 14:46
Run multiple dev server
#!/bin/bash
PROJECT_ROOT=~/proj
COMMANDS=(
myserver "bundle exec rackup"
myclient "yarn dev"
)
$ cat >user-data <<EOF
#cloud-config
hostname: cloudtest.localdomain
user: myuser
password: ubuntu
chpasswd: { expire: True }
ssh_pwauth: True
disk_setup:
/dev/vdb:
@sunnyone
sunnyone / cloud-init.log
Last active June 27, 2020 13:22
cloud-init on Ubuntu 20.04 fails disk_setup
2020-06-27 13:16:19,956 - stages.py[DEBUG]: Running module disk_setup (<module 'cloudinit.config.cc_disk_setup' from '/usr/lib/python3/dist-packages/cloudinit/config/cc_disk_setup.py'>) with frequency once-per-instance
2020-06-27 13:16:19,956 - handlers.py[DEBUG]: start: init-network/config-disk_setup: running config-disk_setup with frequency once-per-instance
2020-06-27 13:16:19,957 - util.py[DEBUG]: Writing to /var/lib/cloud/instances/iid-local01/sem/config_disk_setup - wb: [644] 24 bytes
2020-06-27 13:16:19,957 - helpers.py[DEBUG]: Running config-disk_setup using lock (<FileLock using file '/var/lib/cloud/instances/iid-local01/sem/config_disk_setup'>)
2020-06-27 13:16:19,957 - cc_disk_setup.py[DEBUG]: Partitioning disks: {'/dev/vdb': {'layout': True, 'overwrite': False, 'table_type': 'mbr'}}
2020-06-27 13:16:19,957 - cc_disk_setup.py[DEBUG]: Creating new partition table/disk
2020-06-27 13:16:19,957 - util.py[DEBUG]: Running command ['udevadm', 'settle'] with allowed return codes [0] (shell=False, capture=T
const ForkTsCheckerWebpackPlugin = require("fork-ts-checker-webpack-plugin");
const path = require("path");
const glob = require("glob");
module.exports = {
target: "node",
entry: Object.fromEntries(
glob.sync("*/*.ts", {cwd: "src/ts/functions"})
.map((x) => [x.replace(/\.ts$/, ""), `./src/ts/functions/${x}`])),
https://github.com/supportleap/beacon/blob/def87471012168ff251c3c7797bbe6fe8930b510/lib/graph/schema.rb
https://github.com/tessalt/marmoset/blob/1aa9d16d05490441322bc8016466730839de6eba/app/graph/schema.rb
https://github.com/artsy/exchange/tree/c45262455dfa79bf8e6520f4dabac847683d78ae/app/graphql/types
@sunnyone
sunnyone / hoge.html
Created June 22, 2019 08:00
performance trace
<html>
<head></head>
<body>
<script>
window.perf1start = performance.now();
</script>
<link rel="stylesheet" href="" />
<script>
var perf1 = performance.now() - window.perf1start;