Skip to content

Instantly share code, notes, and snippets.

@shuding
shuding / swr-suspense-journey.md
Created September 14, 2021 12:18
The Journey of SWR and Suspense

The Journey of SWR and Suspense

We are trying to combine the idea of SWR ("stale-while-revalidate") and React Suspense together, and this write-up covers all our findings from this journey.

Background

When React Hooks launched, people started to rely on useEffect to initiate data fetching:

function User () {
@kenmori
kenmori / TypeScriptPractice.md
Last active May 1, 2024 06:02
TypeScript 練習問題集
@lacolaco
lacolaco / awesome-counter.js
Last active August 20, 2018 06:59
文化的な最低限度のWeb Component
export class AwesomeCounter extends HTMLElement {
constructor() {
super();
this.attachShadow({mode: 'open'});
this.state = {};
}
connectedCallback() {
this.setState({count: 0});
@azu
azu / angular2-ecmascript-proposal.md
Last active May 13, 2016 06:38
Angular2 and ECMAScript Proposals

Edit: 2016-05-11

Name Example ECMAScript TypeScript Babel
Class decorator @Component() Stage 1 Yes Yes
Property decorator @Input() Stage 1
@azu
azu / Youtube:floating transcript.user.js
Created December 13, 2015 05:07
Youtube 書き起こしベースの早送り.user.js
// ==UserScript==
// @name Youtube:floating transcript
// @namespace http://efcl.info/
// @description apply panel floating
// @include https://www.youtube.com/watch?v=*
// @version 1
// @grant none
// ==/UserScript==
// Usage: Open Transcript panel
// -> next transcript
/**
* ================== angular-ios9-uiwebview.patch.js v1.1.1 ==================
*
* This patch works around iOS9 UIWebView regression that causes infinite digest
* errors in Angular.
*
* The patch can be applied to Angular 1.2.0 – 1.4.5. Newer versions of Angular
* have the workaround baked in.
*
* To apply this patch load/bundle this file with your application and add a
@azu
azu / vsc.zsh
Created April 30, 2015 04:29
Visual Studio Code from zsh on OS X
# Visual Studio Code
# https://code.visualstudio.com/Docs/setup
function vsc {
if [[ $# = 0 ]]
then
open -a "Visual Studio Code"
else
local argPath="$1"
[[ $1 = /* ]] && argPath="$1" || argPath="$PWD/${1#./}"
open -a "Visual Studio Code" "$argPath"
@japboy
japboy / jade-ftw.md
Last active October 23, 2023 11:18
Jade について。

Jade FTW

こんにちは。今回は現実逃避を兼ねて Jade の素晴らしさをお伝えしたいと思います。

Jade とは何か

[Jade][0] は JST (JavaScript Templates) の一つであり、HTML を書くための[軽量マークアップ言語][1] である [Haml][2] に影響を受けた JavaScript テンプレートエンジンでもあります。

fizz = function f() {
fizz = function () {
fizz = function () {
fizz = f
return "Fizz"
}
}
}
buzz = function f() {
@them0nk
them0nk / rspec_rails_cheetsheet.rb
Created March 23, 2012 03:39
Rspec Rails cheatsheet (include capybara matchers)
#Model
@user.should have(1).error_on(:username) # Checks whether there is an error in username
@user.errors[:username].should include("can't be blank") # check for the error message
#Rendering
response.should render_template(:index)
#Redirecting
response.should redirect_to(movies_path)