Skip to content

Instantly share code, notes, and snippets.

async loadModel(): Promise<io.ModelArtifacts> {
return fetch(`${BUCKET_URL}/model.json`)
.then((response: Response) => response.json())
.then((modelJson) =>
io.getModelArtifactsForJSON(modelJson, (weightsManifest: WeightsManifestConfig) =>
fetch(`${BUCKET_URL}/group1-shard1of1.bin`)
.then((response: Response) => response.arrayBuffer())
.then((weightData: WeightData) => [io.getWeightSpecs(weightsManifest), weightData])
)
) as Promise<io.ModelArtifacts>
// elasticsearch.js client documentation is like getting lost in the woods
// node-fetch does not allow GET with a body
const expect = require("chai").expect;
const esUrl = YOUR_URL_HERE; //paste new url here once resource has been created
const https = require("https");
describe("areena search", () => {
it("should be able to assert", () => {

Keybase proof

I hereby claim:

  • I am sulmanen on github.
  • I am sulmanen (https://keybase.io/sulmanen) on keybase.
  • I have a public key whose fingerprint is 62AF 4CE1 B9FE CC12 6ED0 EB79 F5A7 AE33 6DD1 C569

To claim this, I am signing this object:

@sulmanen
sulmanen / gist:11223172
Created April 23, 2014 16:49
Example Acceptance Test for protractor
describe('Shorty', function () {
'use strict';
var shorty = require('../po/shortyMain.js');
var mainPage;
browser.ignoreSynchronization = true;
beforeEach(function () {
browser.get(baseUrl);
mainPage = new shorty();
.circle {
width: 20px;
height: 20px;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
}
.red {
background-color: red;
@sulmanen
sulmanen / gist:5934616
Created July 5, 2013 13:45
Node twitter search services
var request = require('request');
var restify = require('restify');
var consumer_key = YOUR_KEY;
var consumer_secret = YOUR_SECRET;
var enc_secret = new Buffer(consumer_key + ':' + consumer_secret).toString('base64');
var bearer = {}
var oauthOptions = {
@sulmanen
sulmanen / getTwitterBearer.js
Created March 26, 2013 14:27
Get twitter API 1.1 bearer token
var request = require('request');
var consumer_key = 'YOUR_CONSUMER_KEY';
var consumer_secret = 'YOUR_CONSUMER_SECRET';
var enc_secret = new Buffer(consumer_key + ':' + consumer_secret).toString('base64');
var oauthOptions = {
url: 'https://api.twitter.com/oauth2/token',
headers: {'Authorization': 'Basic ' + enc_secret, 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'},
body: 'grant_type=client_credentials'
};