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
apply plugin: 'com.android.application' | |
apply plugin: 'robolectric' | |
android { | |
compileSdkVersion 21 | |
buildToolsVersion "21.1.2" | |
defaultConfig { | |
applicationId "com.imrenagi.roboelectric_testing" | |
minSdkVersion 15 |
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
package com.imrenagi.roboelectric_testing; | |
public class Person { | |
public Person(){ | |
} | |
public int add () { | |
return 1; | |
} |
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
case class SearchStream(userID: Long, timestamp: Long, query: String) | |
object SearchGen { | |
val lines = Source.fromFile("blog_tags.csv").getLines.toList | |
var words = lines.map(lines => lines.split(",")(1).replace("\"", "")).take(20).map(_.trim.toLowerCase) | |
def searchStream(): Gen[SearchStream] = { | |
val stream = for { | |
userID <- Gen.choose(0,100) |
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
{ | |
"access_token": "25c32831-0b79-4cd2-a9d6-6cae62c5096e", | |
"refresh_token": "35e2d158-2037-402e-a8ff-449276645480", | |
"expiration": 1511923827 | |
} |
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
Pipeline p = Pipeline.create(dataflowOptions); | |
PCollection<String> rsvpInput = p.apply("pubsubReader", PubsubIO.readStrings().fromSubscription(options.getSubscriptionId())); | |
String gcsBucketPath = String.format("gs://%s", options.getOutputBucket()); | |
DateTimeFormatter dtfOut = DateTimeFormat.forPattern("yyyy/MM/dd"); | |
rsvpInput.apply(ParDo.of(new DoFn<String, String>() { | |
@ProcessElement |
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 ( | |
mt "github.com/micro/go-micro/metadata" | |
) | |
// get user info from context passed by auth middleware | |
func getUserInfo(incomingContext context.Context) map[string]string { | |
userMap := map[string]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
//Start of Image Uploader | |
const path = require('path'); | |
const os = require('os'); | |
const fs = require('fs'); | |
var Busboy = require('busboy'); | |
const Storage = require('@google-cloud/storage'); | |
const storage = new Storage(); | |
const uuidv1 = require('uuid/v1'); |
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
//Start of Image Text Extractor | |
const vision = require('@google-cloud/vision'); | |
const PubSub = require(`@google-cloud/pubsub`); | |
const client = new vision.ImageAnnotatorClient(); | |
const pubsub = new PubSub(); | |
exports.processImageFromGCSEvent = (event, callback) => { | |
const file = event.data; |
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 re | |
def extract_identity(data, context): | |
"""Background Cloud Function to be triggered by Pub/Sub. | |
Args: | |
data (dict): The dictionary with data specific to this type of event. | |
context (google.cloud.functions.Context): The Cloud Functions event | |
metadata. | |
""" | |
import base64 |
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": "receipt_text_detector", | |
"version": "0.0.1", | |
"private": true, | |
"license": "Apache-2.0", | |
"author": "Imre Nagi", | |
"engines": { | |
"node": ">=4.3.2" | |
}, | |
"scripts": { |
OlderNewer