Skip to content

Instantly share code, notes, and snippets.

View Quramy's full-sized avatar
👾

Yosuke Kurami Quramy

👾
View GitHub Profile
@sindresorhus
sindresorhus / esm-package.md
Last active May 8, 2024 22:50
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@renatodeleao
renatodeleao / figma-api-get-svg-via-images-endpoint.js
Last active September 14, 2023 17:04
Figma API — Get an svg node (via /images endpoint)
const ACCESS_TOKEN = "token";
const FILE_ID = "fileId";
const NODE_ID = "Check the url for something like => 3%3A2";
const container = document.getElementById("figma-container")
function apiRequest(url) {
return fetch(url, {
method: 'GET',
headers: { "x-figma-token": ACCESS_TOKEN }
}).then(function(response) {
@jakub-g
jakub-g / double-fetch-triple-fetch.md
Last active April 13, 2024 12:22
Will it double-fetch? Browser behavior with `module` / `nomodule` scripts
@dead-claudia
dead-claudia / constraint-types.md
Last active October 3, 2022 19:31
TypeScript Constraint Types Proposal

(All feedback/discussion should take place in the relevant issue.)

TypeScript Constraint Types Proposal

There's multiple requests for the ability to control a type at a much more fine grained level:

  • #12424: Mapped conditional types
  • #12885: Typing function overloads
  • #12880: Bad inference for lambda closures
  • Promises wrongfully accept thenables as their generic parameter (thenables can never be the argument to a then callback).
import * as ts from 'typescript';
import * as Lint from 'tslint';
import { EnforceNamingWalker } from './enforceNamingBase';
export class Rule extends Lint.Rules.AbstractRule {
static FAILURE_STRING = `It is a method that returns Observable, use '*$' suffix`;
apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] {
@kanaka
kanaka / addTwo.wast
Last active June 17, 2021 21:39
Run wast (WebAssembly) in node
(module
(func $addTwo (param i32 i32) (result i32)
(i32.add
(get_local 0)
(get_local 1)))
(export "addTwo" (func $addTwo)))
@yamacraft
yamacraft / Firebase-Admin-NodeJs.md
Last active January 4, 2023 10:28
node.jsからサービスアカウント使ってFirebaseへ接続する時のメモ

検索ワード:Firebase Auth サービスアカウント nodejs

(注意)日本語版の情報は既に少し古い

下準備

サービスアカウントの作成

  1. Firebaseコンソールサイト>歯車>権限 でGoogle APIコンソールっぽい管理画面へ。
  2. サービスアカウント>サービスアカウントを作成をクリックしてアカウントを作成
@brandonroberts
brandonroberts / async-ng-module-loader.ts
Last active April 26, 2019 12:40
Webpack Async NgModule Loader
import {Injectable, NgModuleFactory, NgModuleFactoryLoader, Compiler, Type} from '@angular/core';
class LoaderCallback {
constructor(public callback) {}
}
export let load: Type = (callback: Function) => {
return new LoaderCallback(callback);
};
@ukyo
ukyo / README.md
Last active March 20, 2016 19:08
emscriptenでwabassembly試す
@bsilver8192
bsilver8192 / BUILD
Created March 17, 2016 16:12
Basics of generating a compile_commands.json file with Bazel
py_binary(
name = 'generate_compile_command',
srcs = [
'generate_compile_command.py',
],
deps = [
'//third_party/bazel:extra_actions_proto_py',
],
)