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
#!/usr/bin/env node | |
const {SECRETS} = require('../build/dist/functions/secrets'); | |
const {SecretManagerServiceClient} = require('@google-cloud/secret-manager'); | |
const {join} = require('path'); | |
const {writeFileSync} = require('fs') | |
const client = new SecretManagerServiceClient(); | |
const projectId = process.argv[2]; | |
const outputFile = join(__dirname, '..', `.env.${projectId}`); |
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 { NextFunction, Request, Response } from 'express'; | |
import { LogEntry, LogSeverity, write } from 'firebase-functions/lib/logger'; | |
export function functionRequestLogger(req: Request, res: Response, next: NextFunction) { | |
const start = Date.now(); | |
res.on('finish', () => { | |
const code = res.statusCode; | |
const logEntry: LogEntry = { | |
severity: getSeverity(code), | |
httpRequest: { |
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
/** | |
* Processes a batch of items in parallel using a handler function to generate the promises. It starts by initializing | |
* the amount of Promises given by the batchSize parameter. Once a Promise finishes it immediately starts the next one. | |
* The function returns the results in an array in the order in which the promises finished. | |
* | |
* The optional onUpdate function is called every time a new Promises starts or is finished | |
*/ | |
export async function processPromisesParallel<T, K>( | |
items: T[], | |
batchSize: number, |
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 countries = require('world-countries/countries'); | |
const EU = ["AT","BE","BG","CY","CZ","DE","DK","ES","EE","FI","FR","GB","GR","HR","HU","IE","IT","LT","LU","LV","MT","NL","PL","PT","RO","SK","SI","SE"]; | |
let mapped = countries.map((country) => { | |
return { | |
cca2: country.cca2, | |
ccn3: country.ccn3, | |
cca3: country.cca3, | |
currency: country.currency, | |
name: country.name.common, |
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 de.contentfleet.corporatecampus.ui.widget; | |
import android.annotation.TargetApi; | |
import android.content.Context; | |
import android.graphics.Canvas; | |
import android.graphics.Color; | |
import android.graphics.ColorFilter; | |
import android.graphics.Paint; | |
import android.graphics.Rect; | |
import android.graphics.drawable.Drawable; |
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
private static final String HOST_EMULATOR = "10.0.2.2"; | |
private static final String HOST_PRODUCTION = "example.com"; | |
public static String getHost() { | |
if (BuildConfig.DEBUG) { | |
return (Build.PRODUCT).contains("sdk") ? HOST_EMULATOR : BuildConfig.LOCAL_IP; | |
} | |
return HOST_PRODUCTION; | |
} |
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.playquickly.ui.widget; | |
import android.content.Context; | |
import android.content.res.TypedArray; | |
import android.graphics.Typeface; | |
import android.util.AttributeSet; | |
import android.widget.TextView; | |
import com.playquickly.R; |
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
function timer_start { | |
timer=${timer:-$(date +%s%N)/1000000} | |
} | |
function timer_stop { | |
millis=$(($(date +%s%N)/1000000 - $timer)) | |
if [[ $millis -ge 1000 ]] ; then | |
timer_mout="$(($millis/1000))"s ; | |
else | |
timer_mout="$millis"ms ; |
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
<snippet> | |
<content><![CDATA[ | |
(function ($1){ | |
$SELECTION$2 | |
})($1); | |
]]></content> | |
<!-- Optional: Set a tabTrigger to define how to trigger the snippet --> | |
<tabTrigger>closure</tabTrigger> | |
<!-- Optional: Set a scope to limit where the snippet will trigger --> | |
<scope>source.js</scope> |
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
var EventEmitter = require('events').EventEmitter; | |
module.exports = new EventEmitter(); | |
exports.emitSomethingLater = function() | |
setTimeout(function() { | |
module.exports.emit('something'); | |
}, 1000); | |
} |