https://github.com/typescript-cheatsheets/react https://github.com/passy/awesome-recursion-schemes https://github.com/jwasham/coding-interview-university https://github.com/serhii-londar/open-source-mac-os-apps https://github.com/leonardomso/33-js-concepts https://github.com/danbev/learning-v8 https://github.com/donnemartin/system-design-primer https://github.com/yangshun/front-end-interview-handbook https://github.com/skywind3000/awesome-cheatsheets https://github.com/30-seconds/30-seconds-of-code
In this gist I would like to describe an idea for GraphQL subscriptions. It was inspired by conversations about subscriptions in the GraphQL slack channel and different GH issues, like #89 and #411.
At the moment GraphQL allows 2 types of queries:
query
mutation
Reference implementation also adds the third type: subscription
. It does not have any semantics yet, so here I would like to propose one possible semantics interpretation and the reasoning behind it.
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
https://github.com/kentcdodds/react-testing-library/blob/master/examples/__tests__/react-hooks.js |
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 variables = { | |
keywords: 'Hello', | |
limit: 1, | |
page: 5 | |
} | |
const qs = Object.keys(variables).reduce( | |
(acc, key) => { |
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 from 'react' | |
import { BrowserRouter as Router, Switch } from 'react-router-dom' | |
import routes from './routes' | |
import FancyRoute from './components/tools/FancyRoute' | |
const App = props => | |
<Router> | |
<Switch> | |
{routes.map((route, i) => | |
<FancyRoute key={i} {...route} /> |
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 getItems = (count) => | |
Array.from({ length: count }, (v, k) => k) | |
.map(k => ({ id: `items-${k}`, content: `item ${k}`})); | |
console.log(getItems(10)) |
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
// Function | |
function myFunction() { | |
console.log("Function::", this); | |
} | |
myFunction(); // => Window is invoking the function | |
// Lamda | |
const myanotherFunc = () => console.log("Lamda::", this); |
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
function reverse(str: string): string; | |
function reverse<T>(arr: T[]): T[]; | |
function reverse<T>(stringOrArray: string | T[]): string | T[] { | |
if (typeof stringOrArray === "string") { | |
return stringOrArray | |
.split("") | |
.reverse() | |
.join(""); | |
} | |
return stringOrArray.slice().reverse(); |
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
class Pizza { | |
constructor(private name: string, private price: number) {} | |
} | |
class List<T> { | |
private list: T[] = []; | |
addItem(item: T): void { | |
this.list.push(item); | |
} |
NewerOlder