Skip to content

Instantly share code, notes, and snippets.

View proko's full-sized avatar
🎯
Focusing

Proko Mountrichas proko

🎯
Focusing
View GitHub Profile
@proko
proko / hostedFields.js
Created November 3, 2019 16:37
React hook for Braintree Hosted Fields
import { useState, useEffect } from 'react';
import client from 'braintree-web/client';
import hostedFields from 'braintree-web/hosted-fields';
const fieldsInnerStyles = {
input: {
'font-size': '14px',
},
'input.invalid': {
color: 'red',
.visually-hidden {
clip: rect(1px, 1px, 1px, 1px);
height: 1px;
overflow: hidden;
position: absolute;
white-space: nowrap;
width: 1px;
}
//********//
@proko
proko / regexp.md
Last active December 2, 2015 19:06
Expression examples and short explanations for Regualar Expressions

###Negative and Positive LookAhead

Negative lookahead is indispensable if you want to match something not followed by something else. When explaining character classes, this tutorial explained why you cannot use a negated character class to match a q not followed by a u. Negative lookahead provides the solution: q(?!u). The negative lookahead construct is the pair of parentheses, with the opening parenthesis followed by a question mark and an exclamation point. Inside the lookahead, we have the trivial regex u.

Positive lookahead works just the same. q(?=u) matches a q that is followed by a u, without making the u part of the match. The positive lookahead construct is a pair of parentheses, with the opening parenthesis followed by a question mark and an equals sign.

http://www.regular-expressions.info/lookaround.html