Skip to content

Instantly share code, notes, and snippets.

View GrandSchtroumpf's full-sized avatar
🏠
Working from home

François GrandSchtroumpf

🏠
Working from home
  • Dapps Nation
  • Nantes
View GitHub Profile
@GrandSchtroumpf
GrandSchtroumpf / webauthn.jsx
Created June 6, 2023 10:41
Qwik and Webauthn
View webauthn.jsx
import { component$, event$, useStyles$ } from "@builder.io/qwik";
import type { QwikSubmitEvent} from "@builder.io/qwik";
import { server$, useNavigate } from "@builder.io/qwik-city";
import { FormField, Label, Input } from "~/components/ui/form";
import { startRegistration } from '@simplewebauthn/browser';
import { generateRegistrationOptions, verifyRegistrationResponse } from "@simplewebauthn/server";
import type { RegistrationResponseJSON } from '@simplewebauthn/typescript-types';
import styles from './index.scss?inline';
const rpName = 'Test Company';
@GrandSchtroumpf
GrandSchtroumpf / badge.graphql
Created January 20, 2023 11:26
Sismo API query exampe
View badge.graphql
query {
badge(
network: gnosis,
id: "0xf61cabba1e6fc166a66bca0fcaa83762edb6d4bd-10000009",
) {
balance
metadata {
name
description
image
@GrandSchtroumpf
GrandSchtroumpf / external-script.js
Created May 11, 2020 09:42
External Script to test vscode extension webview
View external-script.js
console.log('Hello World From External source');
@GrandSchtroumpf
GrandSchtroumpf / Markdium-JSON.json
Created May 7, 2020 14:29
Markdium-VSCode extension inside a nx workspace
View Markdium-JSON.json
"assets": [
"apps/vs-code/src/assets",
"apps/vs-code/src/package.json"
]
@GrandSchtroumpf
GrandSchtroumpf / Markdium-typescript.ts
Created May 7, 2020 14:29
Markdium-VSCode extension inside a nx workspace
View Markdium-typescript.ts
RouterModule.forRoot([], { useHash: true })
@GrandSchtroumpf
GrandSchtroumpf / Markdium-JSON.json
Created May 7, 2020 14:29
Markdium-VSCode extension inside a nx workspace
View Markdium-JSON.json
{
"version": "2.0.0",
"tasks": [{
"type": "npm",
"script": "watch",
"problemMatcher": "$tsc-watch",
"isBackground": true,
"presentation": {
"reveal": "never"
},
@GrandSchtroumpf
GrandSchtroumpf / Markdium-typescript.ts
Created May 7, 2020 14:29
Markdium-VSCode extension inside a nx workspace
View Markdium-typescript.ts
import { commands, ExtensionContext, window, ViewColumn } from 'vscode';
// On activation
export function activate(context: ExtensionContext) {
// Register command "start"
commands.registerCommand('start', () => {
const panel = window.createWebviewPanel(
'studio', // Key used to reference the panel
'Studio', // Title display in the tab
ViewColumn.Active, // Editor column to show the new webview panel in.
@GrandSchtroumpf
GrandSchtroumpf / Markdium-typescript.ts
Created May 7, 2020 14:29
Markdium-VSCode extension inside a nx workspace
View Markdium-typescript.ts
import { commands, ExtensionContext, window, ViewColumn, Uri } from 'vscode';
import { promises as fs } from 'fs';
import { join } from 'path';
// On activation
export function activate(context: ExtensionContext) {
// Register command "start"
commands.registerCommand('start', async () => {
const panel = window.createWebviewPanel(
'studio',
@GrandSchtroumpf
GrandSchtroumpf / Markdium-JSON.json
Created May 7, 2020 14:29
Markdium-VSCode extension inside a nx workspace
View Markdium-JSON.json
{
"name": "studio",
"version": "0.0.0",
"main": "main.js",
"engines": {
"vscode": "^1.44.0"
},
"contributes": {
"commands": [{
"command": "start",
@GrandSchtroumpf
GrandSchtroumpf / Markdium-typescript.ts
Created May 7, 2020 14:29
Markdium-VSCode extension inside a nx workspace
View Markdium-typescript.ts
const index = join(context.extensionPath, 'studio/index.html');
// Refresh the webview on update from the code
const updateWebview = async () => {
const html = await fs.readFile(index, 'utf-8');
panel.webview.html = html.replace(matchLinks, toUri);
}
// In dev mode listen on changes from index.html & update the view
if (!environment.production) {