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
| function h2dec(hour,min) { | |
| hour = parseInt(hour, 10) || 0 | |
| minutes = parseInt(min, 10) || 0 | |
| var minuteDecimalToHour = parseInt((min/6)*10, 10) | |
| return parseFloat([hour,minuteDecimalToHour].join('.')) | |
| } |
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 falcon | |
| import json | |
| class TabletsCollection(object): | |
| def on_get(self, req, res): | |
| params = {} | |
| for param in req.params: | |
| params[param] = req.params[param] | |
| res.body = json.dumps({ |
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
| // convert 0..255 R,G,B values to binary string | |
| RGBToBin = function(r,g,b){ | |
| var bin = r << 16 | g << 8 | b; | |
| return (function(h){ | |
| return new Array(25-h.length).join("0")+h | |
| })(bin.toString(2)) | |
| } | |
| // convert 0..255 R,G,B values to a hexidecimal color string | |
| RGBToHex = function(r,g,b){ |
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 type { | |
| APIGatewayEvent, | |
| Context, | |
| ProxyCallback as PC, | |
| } from 'flow-aws-lambda' | |
| /** | |
| * | |
| * @param {*} cb AWS lambda callback | |
| * @param {*} message | |
| * @param {*} status |
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 { createApolloFetch } = require('apollo-fetch'); | |
| const fetch = createApolloFetch({ | |
| uri: 'https://1jzxrj179.lp.gql.zone/graphql', | |
| }); | |
| fetch({ | |
| query: '{ posts { title }}', | |
| }).then(res => { | |
| console.log(res.data); |
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 * as mh from 'multihashes' | |
| import * as fs from 'fs' | |
| import * as path from 'path' | |
| const imagePath = path.resolve(rootPath, image) | |
| const buf = fs.readFileSync(imagePath) | |
| const hash = mh.encode(buf, 'sha2-256') | |
| consle.log(mh.toB58String(hash)) |
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 {PhotoConnectionResolvers} from '../generated/graphqlgen' | |
| export const PhotoConnection: PhotoConnectionResolvers.Type = { | |
| ...PhotoConnectionResolvers.defaultResolvers, | |
| pageInfo: (parent, args, ctx, info) => { | |
| // here args is empty | |
| return ctx.db.photosConnection(args).pageInfo() | |
| }, | |
| edges: (parent, args, ctx, info) => { |
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
| // @flow | |
| import React, {Component} from 'react' | |
| import {Query} from 'react-apollo' | |
| import gql from 'graphql-tag' | |
| import {withStyles} from '@material-ui/core/styles' | |
| import Grid from '@material-ui/core/Grid' | |
| import CircularProgress from '@material-ui/core/CircularProgress' | |
| import Gallery from 'react-photo-gallery' | |
| import SelectedImage from '../../components/Image/SelectedImage' |
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
| Verifying my Blockstack ID is secured with the address 1BsPosJc5tAbPPbCZfR2A1qUirji1344ER https://explorer.blockstack.org/address/1BsPosJc5tAbPPbCZfR2A1qUirji1344ER |
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 isItIntrospectionQuery = (query: string): boolean => { | |
| return query.includes('IntrospectionQuery') | |
| } | |
| const postgraphileOptions = { | |
| async pgSettings(req: Request) { | |
| if (isItIntrospectionQuery(JSON.stringify(req.body))) return {} | |
| return { | |
| role: 'DATABASE_VISITOR', |