Skip to content

Instantly share code, notes, and snippets.

@yaakaito
yaakaito / css-has.md
Last active January 19, 2024 16:23
:has() でリストが空のときにセクションごと消す

:has() が 2023 年末にすべてのブラウザでサポートされて、現実的に利用できるようになった。

「渡したセレクターにマッチする子要素を持つ親要素であるか」を判定できるので、例えばリストが空のときにセクションごと消すことができる。

<style>
section:has(ul:empty) {
@yaakaito
yaakaito / zustand-persisting-chrome.md
Last active January 18, 2024 10:00
zustand を chrome 拡張の storage で永続化する
@yaakaito
yaakaito / error.ts
Created December 10, 2019 14:39
TypeScript で instaceof できる Error 作るやつ
class MyError extends Error {
constructor(message: string) {
super(message)
this.name = new.target.name
Object.setPrototypeOf(this, new.target.prototype)
}
}
@yaakaito
yaakaito / isBrowser.js
Created November 18, 2019 14:12
isBrowser
export const isBrowser = typeof navigator !== 'undefined'
@yaakaito
yaakaito / webpack.config.js
Created October 1, 2019 19:13
適当にデモ用の最小構成
const path = require('path')
const HtmlWebpackPlugin = require('html-webpack-plugin')
module.exports = (env = {}) => {
return {
mode: 'development',
entry: {
index: path.resolve(__dirname, 'src/index.ts')
},
output: {
class FirstViewSpec: QuickSpec {
override func spec() {
describe("ラベルは") {
context("「ハロー」が押された時") {
grey_execute_sync({
EarlGrey.select(elementWithMatcher:grey_buttonTitle("ハロー"))
.perform(grey_tap())
it("「ハロー」と表示される") {
EarlGrey.select(elementWithMatcher: grey_accessibilityLabel("LABEL"))
.assert(grey_text("ハロー"))
@yaakaito
yaakaito / compiled.js
Last active January 2, 2016 09:18
型とか微妙になってるけど多分こんなん
var BankAccount = (function () {
function BankAccount(balance) {
this.balance = balance;
}
BankAccount.prototype.increase = function (money) {
var a = _.clone(this);
a.balance += money;
return a;
};
<!doctype html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<title>GREEの皆様!弊社のアプリを開発しませんか?</title>
<link rel="shortcut icon" href="" type="image/vnd.microsoft.icon">
<meta name="copyright" content="©yuta Uchiyama 2013">
<meta name="keywords" content="GREE,ドウゲンザッカーバーグ,採用,開発,エンジニア" />
<meta name="description" content="GREEの皆様。弊社のアプリを開発しませんか?" />
<meta property="og:title" content="GREEの皆様。弊社のアプリを開発しませんか?" />
javascript:(function(){var modal = SNS.TextInputModalView.createWithParameters({title: 'a',length: 200,doneCallback: function() {},cancelCallback: function() {}});modal.show();})()
<!doctype html>
<html>
<head>
<meta charset="utf8" />
<title>めにゅ〜</title>
<style>
header {
width: 100%;
height: 44px;
position: fixed;