This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState, useCallback } from 'react'; | |
import useForm from './use-form'; | |
import './styles.css'; | |
export default function App() { | |
const [state, handleChange] = useForm({ | |
userName: '', | |
age: '', | |
status: 'beginner', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var oneLiner = (script, { | |
splitter = /( +|\n+|\t+|\/|'|")/g, | |
varDeclaration = /^(var|const|let)$/, | |
testRegex = '/', | |
testString = /'|"/, | |
filterer = /[ \n\t]+/ | |
} = {}, prev = '', insideRegex = false, insideString = false) => | |
script | |
.split(splitter) | |
.map((_) => |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const split = (arr = [], n, ...arrs) => arr.length ? split(arr.slice(n), n, ...arrs, arr.slice(0, n)) : arrs | |
const splitIn = (arr = [], n) => split(arr, Math.ceil(arr.length / n)) | |
const flat = (arr) => arr.reduce((a, b) => a.concat(b), []) | |
const mapParallel = (prom) => (arr) => Promise.all(arr.map(prom)) | |
const mapSeries = (arr, prom, prevProm = Promise.resolve()) => | |
Promise.all(arr.map(val => (prevProm = prevProm.then(() => prom(val))))) | |
const allLimit = (arr, limit) => ({ then: (prom) => mapSeries(split(arr, limit), mapParallel(prom)).then(flat) }) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Verifying that "anmo26.id" is my Blockstack ID. https://onename.com/anmo26 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[alias] | |
co = checkout | |
cob = checkout -b | |
cod = branch -D | |
st = status | |
pl = pull | |
ps = push -u origin | |
pf = push --force-with-lease | |
rb = rebase | |
ri = rebase -i |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.jsonpCbs = { }; | |
var jsonp = function( o ) { | |
var key = 'cb' + Math.floor( Math.random( ) * 100000 ); | |
var sep = o.uri.indexOf( '?' ) < 0 ? '?' : '&'; | |
var scriptEl = document.createElement( 'script' ); | |
scriptEl.setAttribute( 'type' , 'text/javascript' ); | |
scriptEl.setAttribute( 'src' , [ o.uri , sep , o.jsonp || 'jsonp' , '=jsonpCbs.' , key ].join( '' ) ); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#First create a repo | |
mkdir A && cd A && git init && touch a.dev && touch a.prod && git add -A && git commit -m 'init A' && cd ../ | |
#Lets create another repo that will use A as submodule with sparse-checkout | |
mkdir B && cd B && git init && touch b && git add -A && git commit -m 'init B' | |
#Now we will clone A as submodule of B and will say that file/dir we only want to use in B | |
git submodule add ../A/ A && cd A && git config core.sparsecheckout true && echo a.prod >> ../.git/modules/A/info/sparse-checkout && git read-tree -mu HEAD && cd ../ && git add -A && git commit -m 'add A as submodule/sparse-checkout' && cd ../ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<VirtualHost *:80> | |
# The ServerName directive sets the request scheme, hostname and port that | |
# the server uses to identify itself. This is used when creating | |
# redirection URLs. In the context of virtual hosts, the ServerName | |
# specifies what hostname must appear in the request's Host: header to | |
# match this virtual host. For the default virtual host (this file) this | |
# value is not decisive as it is used as a last resort host regardless. | |
# However, you must set it for any further virtual host explicitly. | |
#ServerName www.example.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | |
<title>test pushState (with compatibility)</title> | |
<meta name="og:description" content=<?php echo '"este é o pedido: '. urldecode( $_SERVER[ 'REQUEST_URI' ] ) .'"'; ?>/> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"> | |
<meta name="HandheldFriendly" content="True"> | |
<meta name="MobileOptimized" content="320"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | |
<title>test pushState</title> | |
<meta name="og:description" content=<?php echo '"este é o pedido: '. urldecode( $_SERVER[ 'REQUEST_URI' ] ) .'"'; ?>/> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"> | |
<meta name="HandheldFriendly" content="True"> | |
<meta name="MobileOptimized" content="320"> |
NewerOlder