Skip to content

Instantly share code, notes, and snippets.

View miklosme's full-sized avatar

Miklos Megyes miklosme

View GitHub Profile
@miklosme
miklosme / generate_component.sh
Last active April 20, 2016 18:24
React Native components generation
#!/usr/bin/env bash
if [[ $# -eq 0 ]] ; then
echo 'Invalid component name.'
exit 1
fi
COMPONENT_PATH="$(pwd)/js/common/$1"
mkdir $COMPONENT_PATH;
@miklosme
miklosme / generate_stateless_component.sh
Created June 10, 2016 08:50
React Native stateless component generator
#!/usr/bin/env bash
if [[ $# -eq 0 ]] ; then
echo 'Invalid component name.'
exit 1
fi
COMPONENT_PATH="$(pwd)/Components/$1"
mkdir $COMPONENT_PATH;
@miklosme
miklosme / settings.json
Created February 20, 2019 11:20
vscode settings.json
{
"flow.enabled": false,
"search.useIgnoreFiles": true,
"typescript.autoImportSuggestions.enabled": false,
"workbench.editor.enablePreview": false,
"javascript.suggestionActions.enabled": false,
"javascript.implicitProjectConfig.experimentalDecorators": true,
"files.autoSave": "onFocusChange",
"files.exclude": {
"**/.cache": true,
@miklosme
miklosme / scriptable.js
Last active October 29, 2020 10:59
Scriptable script to create a FiveThirtyEight forecast widget
const url = `https://projects.fivethirtyeight.com/2020-election-forecast/us_simulations.json`;
const req = new Request(url);
const res = await req.loadJSON();
if (config.runsInWidget) {
const biden = res[0].simulations.filter((x) => x.winner === 'Biden').length;
const trump = res[0].simulations.filter((x) => x.winner === 'Trump').length;
let widget = new ListWidget();
widget.backgroundColor = new Color('#000');
import { useEffect, useRef, useState } from "react"
import { addPropertyControls, ControlType } from "framer"
// This is an unanimated 4 color gradient code component for Framer.
// TODO: support animation
function rgbToHex(rgb) {
if (rgb.startsWith("rgb(")) {
// Choose correct separator
let sep = rgb.indexOf(",") > -1 ? "," : " "
import type { ComponentType } from "react"
import { useState, useEffect } from "react"
function useTyping(str, speed = 20) {
const [pos, setPos] = useState(0)
useEffect(() => {
let i = 0
let interval = setInterval(() => {
if (i < str.length) {
setPos(++i)
@miklosme
miklosme / filter.txt
Created August 31, 2022 08:58
Hide low-quality dev sites with uBlock
google.*##.g:has(a[href*="w3schools.com"])
google.*##.g:has(a[href*="geeksforgeeks.com"])
google.*##.g:has(a[href*="geeksforgeeks.org"])
google.*##.g:has(a[href*="tutorialspoint.com"])
google.*##.g:has(a[href*="tutorialspoint.dev"])
google.*##.g:has(a[href*="freetimelearning.com"])
google.*##.g:has(a[href*="w3docs.com"])
google.*##.g:has(a[href*="javatpoint.com"])
import { useId, useRef, useState } from 'react'
import { Button } from '@/components/Button'
import { CheckCircleIcon, ClockIcon } from '@heroicons/react/20/solid'
import { ExclamationTriangleIcon } from '@heroicons/react/24/outline'
export function SignUpForm() {
const id = useId()
const form = useRef()
const [subsciptionState, setSubscriptionState] = useState('idle')