Skip to content

Instantly share code, notes, and snippets.

View dalcib's full-sized avatar

Dalci de Jesus Bagolin dalcib

View GitHub Profile
@dalcib
dalcib / MdxContent.js
Created August 17, 2022 13:08 — forked from danieldunderfelt/MdxContent.js
MDX in React-native
// Use your MDX content with this component.
import React from 'react'
import MDX from '@mdx-js/runtime'
import components from '../utils/markdown/markdown'
// Renders a cimple loading spinner as a test
import Loading from './Loading'
const mdxComponents = {
@dalcib
dalcib / routes.tsx
Last active August 6, 2022 23:24
react-native-web vite
// src/routes.tsx
import { Fragment, lazy, Suspense } from 'react'
import { Routes as BrowserRoutes, Route } from 'react-router-dom'
const PRESERVED = import.meta.glob('/src/pages/(_app|404).tsx', {eager: true})
const ROUTES = import.meta.glob('/src/pages/**/[a-z[]*.tsx')
const _ROUTES = {
'/src/pages/index.tsx': { default: ƒ Index(), ... },
@dalcib
dalcib / genotes.js
Last active July 20, 2021 18:24
Ramdom music notes generator
var context=new AudioContext();
var o=null;
var g=null;
var note
var notes = [130.8, 138.6, 146.8, 155.6, 164.8, 174.6, 185.0, 196.0, 207.7, 220.0, 233.1, 246.9, 261.6, 277.2, 293.7, 311.1, 329.6, 349.2, 370, 392, 415.3, 440, 466.2, 493.9] //, 523.3, 554.4, 587.3, 622.3, 659.3, 698.5, 740, 784, 830.6, 880, 932.3, 987.8]
var swaras = ['Sa','re','Re','ga','Ga','Ma','MA','Pa','dha','Dha','ni','Ni','Sa*','re','Re*','ga*','Ga*','Ma*','MA*','Pa*','dha*','Dha*','ni*','Ni*', 'Sa**']
function playNote(frequency) {
@dalcib
dalcib / eslint-universe-global.cmd
Last active September 20, 2020 15:20
eslint config
npm i -g eslint eslint-config-universe eslint-plugin-import eslint-plugin-prettier @typescript-eslint/eslint-plugin eslint-plugin-babel prettier @typescript-eslint/parser babel-eslint eslint-plugin-react eslint-plugin-react-hooks eslint-config-prettier

Sure, I'm trying something a bit different, here's example usage:

class TodoList extends Store<{
  id: number
}> {
  items: Todo[] = [{ text: 'hi', done: false }]

  get itemsDiff() {
    return this.items.map((x, i) => i)
const fs = require("fs");
const bundle = fs.readFileSync("path-to-webpack-bundle.html", "utf8");
const escaped = JSON.stringify(bundle);
const js = `export default ${escaped}`;
fs.writeFileSync("javascript-output-file.ts", js);
@dalcib
dalcib / .block
Created May 1, 2020 18:28 — forked from ganeshv/.block
Zoomable Treemap Template
license: gpl-3.0
{
"$schema": "https://vega.github.io/schema/vega/v5.json",
"width": 400,
"height": 400,
"padding": 5,
"signals": [
{
"name": "method",
"value": "squarify",
"bind": {
@dalcib
dalcib / expo-firestore-persistence-hack.js
Created April 20, 2020 11:17 — forked from zwily/expo-firestore-persistence-hack.js
A fragile weaving of various modules together to convince the Firestore web SDK to use persistence in an un-ejected Expo app.
/*
expo-firestore-persistence-hack
A fragile weaving of various modules together to convince the Firestore
web SDK to use persistence in an un-ejected Expo app.
To use, first:
```
$ expo install expo-sqlite
@dalcib
dalcib / Counter.js
Created October 14, 2019 11:02 — forked from tannerlinsley/Counter.js
Global React State with Context and Immer
import { useCount, useIncrement, useDecrement } from './store.Count'
export default function Counter () {
const count = useCount()
const increment = useIncrement()
const decrement = useDecrement()
return (
<div>
<div>Count: {count}</div>