This file contains hidden or 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
| GUI engine | |
| // tell the engine to switch to UCI mode | |
| uci | |
| // engine identify | |
| id name Shredder | |
| id author Stefan MK | |
| // engine sends the options it can change |
This file contains hidden or 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 {makeExecutableSchema} from 'graphql-tools'; | |
| const typeDefs = ` | |
| type Query { | |
| message(id: ID!): String! | |
| } | |
| type Mutation { | |
| message(id: ID!): String! | |
| } |
This file contains hidden or 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 { Query } from 'react-apollo'; | |
| import gql from "graphql-tag"; | |
| const query = gql`{ | |
| currencyOfInterest @client | |
| }` | |
| const ExchangeSelector = ({data: {rates}}) => ( | |
| <Query query={query}> |
This file contains hidden or 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 logo from './logo.svg'; | |
| import './App.css'; | |
| import { ApolloProvider } from "react-apollo"; | |
| import ApolloClient from "apollo-boost"; | |
| const client = new ApolloClient({ | |
| uri: "https://w5xlvm3vzz.lp.gql.zone/graphql" | |
| }); | |
| const App = () => ( | |
| <ApolloProvider client={client}> |
This file contains hidden or 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 { Query } from "react-apollo"; | |
| import gql from "graphql-tag"; | |
| const ExchangeRates = () => ( | |
| <Query | |
| query={gql` | |
| { | |
| rates(currency: "USD") { | |
| currency | |
| rate |
This file contains hidden or 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 log = (target, name, descriptor) => { | |
| /* | |
| target: the class instance of the method | |
| name: the name of the method | |
| descriptor: | |
| value: the method itself | |
| */ | |
| const original = descriptor.value; // hold onto the original function |
This file contains hidden or 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 MyClass { | |
| @log | |
| sum(a, b) { | |
| return a + b; | |
| } | |
| } | |
| const instance = new MyClass() | |
| instance.sum(2, 3); // execute the decorated method |
This file contains hidden or 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 STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg; | |
| var ARGUMENT_NAMES = /([^\s,]+)/g; | |
| function getParamNames(func) { | |
| var fnStr = func.toString().replace(STRIP_COMMENTS, ''); | |
| var result = fnStr.slice(fnStr.indexOf('(') + 1, fnStr.indexOf(')')).match(ARGUMENT_NAMES); | |
| if (result === null) | |
| result = []; | |
| return result; | |
| } |
This file contains hidden or 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 insertStuff = (target, name, descriptor) => { | |
| const original = descriptor.value; | |
| if (typeof original === 'function') { | |
| const paramNames = getParamNames(original) | |
| descriptor.value = function () { | |
| const args = paramNames.reduce((arr, pn, i) => { | |
| arr[i] = this.newStuff[pn]; | |
| return arr;}, [] ) |