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 routeHandler from '../src/routeHandler'; | |
import { mockResponse, mockRequest } from './test-helpers'; | |
jest.mock('@googlemaps/google-maps-services-js'); | |
import { Client } from '@googlemaps/google-maps-services-js'; | |
const mockClient = { | |
geocode: jest.fn(), | |
}; |
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
doctype html5 | |
html | |
head | |
title Test Page | |
body | |
.error #{message} | |
form(action='/login' method='POST') | |
label Email | |
input(type='email' name='email') |
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
// | |
// Implementation using express-jwt middle | |
// | |
var express = require('express'), | |
ejwt = require('express-jwt'), | |
jwt = require('jsonwebtoken'), | |
passport = require('passport'), | |
bodyParser = require('body-parser'), | |
LocalStrategy = require('passport-local').Strategy, | |
BearerStrategy = require('passport-http-bearer').Strategy; |
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 { Static, Type } from '@sinclair/typebox' | |
import fastify, { FastifyInstance, FastifyPluginAsync } from 'fastify' | |
import type { RouteGenericInterface, RouteHandler } from 'fastify/types/route' | |
const port = 8080 | |
const requestBodySchema = Type.Object({ | |
email: Type.Readonly(Type.String({ format: 'email' })), | |
}) |
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
{ | |
"name": "streamingtest", | |
"version": "0.0.1", | |
"engines": { | |
"node": ">=0.6.0" | |
}, | |
"dependencies": { | |
"express": "2.5.x", | |
"coffee-script": "1.2.x" | |
}, |
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
export const Main: React.FunctionComponent = () => { | |
const [ markers, setMarkers ] = React.useState<ReadonlyArray<Marker>>([]); | |
// Need to be in separate files for lazy loading, otherwise using window.google.maps | |
// in the actual map component will throw | |
return ( | |
<LoadScript googleMapsApiKey={apiKey}> | |
<Map markers={markers} /> | |
</LoadScript> | |
); |
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
/** | |
* Convert postal number geometries to WGS84 coordinates for geocoding | |
*/ | |
import axios from 'axios'; | |
import * as proj4 from 'proj4'; | |
import * as turf from '@turf/turf'; | |
import { promisify } from 'util'; | |
import * as fs from 'fs'; | |
const writeFile = promisify(fs.writeFile); |
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 axios from 'axios'; | |
import * as proj4 from 'proj4'; | |
interface Result { | |
readonly features: ReadonlyArray<{ | |
readonly properties: { | |
readonly posti_alue: string; | |
}; | |
}>; | |
} |
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
# Convert binary encoded object SID to a string | |
# (eg. S-1-5-21-1004336348-1177238915-682003330-512) | |
# | |
# SID format: https://technet.microsoft.com/en-us/library/cc962011.aspx | |
# | |
# ldapjs `searchEntry` has attribute `raw` that holds the raw | |
# values, including the `objectSid` buffer when one exists. Pass that | |
# buffer to get the string representation that can then be easily | |
# used in LDAP search filters, for example. | |
# |
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 crypto = require('crypto'); | |
const ACCOUNT = '375917'; | |
const SECRET = 'SAIPPUAKAUPPIAS'; | |
const headers = { | |
'checkout-account': ACCOUNT, | |
'checkout-algorithm': 'sha256', | |
'checkout-method': 'POST' | |
}; |
NewerOlder