Skip to content

Instantly share code, notes, and snippets.

Fatih Altinok frontsideair

Block or report user

Report or block frontsideair

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@frontsideair
frontsideair / form.js
Created Mar 12, 2018
Type-safe form validation
View form.js
// @flow
import React, { Component } from "react"
import { isIP, isURL, isEmail, isPort } from "validator"
import { allValid, getErrors } from "./validation"
import { makeAPICall } from "./api"
// a flat data structure for viewing in the UI
type Inputs = {
hasAuth: boolean,
View keybase.md

Keybase proof

I hereby claim:

  • I am frontsideair on github.
  • I am frontsideair (https://keybase.io/frontsideair) on keybase.
  • I have a public key ASAPGnaC_3WM2q986wv9RYI23GHLA7eJVZ11fbdqFt0ylwo

To claim this, I am signing this object:

@frontsideair
frontsideair / _rxjs-ajax.md
Last active Mar 30, 2017
esnextbin sketch
View _rxjs-ajax.md

Enter the username of a Github user to get their full name. Request on keystroke with XHR cancellation instead of debounce, which results in less latency and better user experience. Very simple implementation with RxJS. The magic is the .switch operator.

See live on esnextbin, don't forget to open Network tab in DevTools to see cancellation.

@frontsideair
frontsideair / objects_and_closures.js
Created Mar 2, 2017
Objects and closures are (in some ways) the same thing! (Illustrated in ES6)
View objects_and_closures.js
const obj = { foo: 'bar', baz: 'quux' } // let's define our object
const { foo, baz } = bar // the keys are now in the envorinment!
const hello = 'world' // hello is defined in our environment
const newObj = { hello } // and now it's captured in our object!
@frontsideair
frontsideair / comma-operator-push-pop.js
Created Jan 3, 2017
Simple implementation of push/pop with comma operator, function scope
View comma-operator-push-pop.js
const pop = (arr, tmp) => (tmp = arr.slice(0), tmp.pop(), tmp)
const push = (arr, item, tmp) => (tmp = arr.slice(0), tmp.push(item), tmp)
// Can you see why and how this works? Does it really? Can you guess if it's pure or impure?
// Does it modify any of its arguments, or pollute global scope?
@frontsideair
frontsideair / copy-no-flash-test.md
Last active Feb 7, 2017
Test case for copying test with native APIs. (Works on latest Chrome, Firefox, Safari.)
View copy-no-flash-test.md

Test case for copying test with native APIs. (Works on latest Chrome, Firefox, Safari.)

made with esnextbin

@frontsideair
frontsideair / index.html
Last active Feb 7, 2017
RR4 isolated test case
View index.html
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>ESNextbin Sketch</title>
<!-- test here: https://esnextb.in/?gist=7cba0a35afc77d49ebb2bf5b99e944f1 -->
</head>
<body>
<div id="app"></div>
</body>
@frontsideair
frontsideair / cycle-with-reducers.js
Created Jul 7, 2016
Cycle.js with reducer-like events
View cycle-with-reducers.js
const Cycle = require('@cycle/core');
const {makeDOMDriver, div, button} = require('@cycle/dom');
const {Observable} = require('rx');
function intent({ DOM }) {
const incr$ = DOM
.select('.incr')
.events('click')
.map(() => prev => prev + 1);
@frontsideair
frontsideair / index.html
Last active Feb 7, 2017
Some ideas to make React component state management look more like redux
View index.html
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>ESNextbin Sketch</title>
<!-- test here: https://esnextb.in/?gist=fa2b7e6775c242a76489c0ebc329ba7f -->
</head>
<body>
<div id="app"></div>
</body>
You can’t perform that action at this time.