Skip to content

Instantly share code, notes, and snippets.

View wtrocki's full-sized avatar
🚀
Making API Backends an Better Place!

Wojciech Trocki wtrocki

🚀
Making API Backends an Better Place!
View GitHub Profile
subscription subscribeTasks{
subscribeTasks{
id
title
description
version
}
}
subscription SubscribeData{
subscribeTasks{
id
title
description
version
}
}
@wtrocki
wtrocki / mobile-services.js
Last active March 12, 2019 12:14 — forked from psturc/mobile-services.js
For release 0.1.0 of ionic-showcase
let config = {
"version": 1,
"namespace": "test",
"clientId": "org.aerogear.ionic.showcase",
"services": [
{
"id": "e339e761-3687-11e9-9467-0af08791569c",
"name": "sync-app-test-org.aerogear.ionic.showcase",
"type": "sync-app",
"url": "https://sync-app-showcase-server-demo.comm2.skunkhenry.com/graphql",
@wtrocki
wtrocki / Note to Frequency
Created August 21, 2018 22:22 — forked from stuartmemo/Note to Frequency
Convert note to frequency
// Takes string of Note + Octave
// Example:
// var frequency = getFrequency('C3');
var getFrequency = function (note) {
var notes = ['A', 'A#', 'B', 'C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#'],
octave,
keyNumber;
if (note.length === 3) {
@wtrocki
wtrocki / postgres-cheatsheet.md
Created August 9, 2018 15:12 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@wtrocki
wtrocki / AndroidManifest.xml
Created July 3, 2018 08:41 — forked from BrandonSmith/AndroidManifest.xml
Quick example of how to schedule a notification in the future using AlarmManager
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.cards.notification">
<uses-sdk
android:minSdkVersion="17"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
@wtrocki
wtrocki / use_tag.sh
Last active June 11, 2018 12:42 — forked from david-martin/use_tag.sh
Usage: `./use_tag.sh 1.0.0-alpha`
#!/bin/sh
set -x
TAG=1.0.0-alpha
oc patch deployment webconsole -n openshift-web-console -p "{\"spec\": {\"template\": {\"spec\": {\"containers\": [{\"name\": \"webconsole\", \"image\": \"aerogear/origin-web-console:$TAG\"}]}}}}"
#oc get configmap broker-config -n ansible-service-broker -o yaml | sed -e "s/tag:.*/tag: \"$TAG\"/" | oc replace -n ansible-service-broker -f -

HTTP Rest API receive 'push request', this gets processed in PushNotificationSenderEndpoint.send(), which eventually calls an async EJB (NotificationRouter.submit()) which performs a grouping/mapping and fires a CDI event per Variant.

This Event is received in the MessageHolderWithVariantsProducer.queueMessageVariantForProcessing() method, which basically sticks the submitted event into a transactional JMS send, based on the variant type a different queue is selected (mainly to keep things separated). The JMS listener MessageHolderWithVariantsConsumer.onMessage() reads from these queues, and fires a different CDI event, which kicks in the TokenLoader.

The TokenLoader generally iterates over all variants (for a given type, see the grouping/mapping done in NotificationRouter), and starts to query tokens from the database, as a steam.

The tokens are in different batches, with different default sizes per Push_Network, to not overflow the push network (e.g. google (non topic case) only allows 1

@wtrocki
wtrocki / MetricsIntegrationTest.swift
Last active April 9, 2018 09:42 — forked from psturc/MetricsIntegrationTest.swift
metrics integration testing
//
// MetricsIntegrationTest.swift
// AeroGearSdkExampleTests
@testable import AGSCore
import Foundation
import XCTest
@wtrocki
wtrocki / .eslintrc
Created November 28, 2017 13:11 — forked from radiovisual/.eslintrc
React Native AirBnB ESLint Config
{
"parser": "babel-eslint",
"plugins": [
"react",
"react-native"
],
"parserOptions": {
"ecmaFeatures": {
"jsx": true,
"modules": true