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
@domenic
domenic / portable-node.md
Created May 25, 2012 21:03
Tips for Writing Portable Node.js Code

Node.js core does its best to treat every platform equally. Even if most Node developers use OS X day to day, some use Windows, and most everyone deploys to Linux or Solaris. So it's important to keep your code portable between platforms, whether you're writing a library or an application.

Predictably, most cross-platform issues come from Windows. Things just work differently there! But if you're careful, and follow some simple best practices, your code can run just as well on Windows systems.

Paths and URLs

On Windows, paths are constructed with backslashes instead of forward slashes. So if you do your directory manipulation

@stuartmemo
stuartmemo / Note to Frequency
Created September 22, 2012 15:00
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) {
@Kartones
Kartones / postgres-cheatsheet.md
Last active July 16, 2024 10:46
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -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)
@staltz
staltz / introrx.md
Last active July 15, 2024 15:43
The introduction to Reactive Programming you've been missing
@wei-lee
wei-lee / dev.json
Last active November 24, 2015 20:56
{
"name": "dev",
"description": "Development role",
"json_class": "Chef::Role",
"default_attributes": {
"host_src_dir": "/Users/weili/work/fh/eng/",
"feedhenry_common": {
"src": "/mnt/src"
},
"vm": {
@wtrocki
wtrocki / ModRain Documentation.md
Last active April 10, 2017 13:25
Modrain - Modular architecture framework for modular client and server applications written in javascript/typescript.

ModRain Build Status

img

ModRain (Module Rain) modular architecture framework for modular client and server applications written in javascript/typescript. Use Modrain to implement microservices architecture for client and server side javascript apps.

Idea

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

@swalkinshaw
swalkinshaw / tutorial.md
Last active November 13, 2023 08:40
Designing a GraphQL API
@david-martin
david-martin / use_tag.sh
Last active June 11, 2018 11:54
Usage: `./use_tag.sh 1.0.0-alpha`
#!/bin/sh
set -x
TAG=$1
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 -
@psturc
psturc / mobile-services.js
Created February 22, 2019 15:14
For release 0.1.0 of ionic-showcase
let config = {
"version": 1,
"namespace": "test",
"clientId": "org.aerogear.ionic.showcase",
"services": [
{
"id": "e973164c-3687-11e9-9467-0af08791569c",
"name": "keycloak",
"type": "keycloak",
"url": "https://keycloak-route-test.comm2.skunkhenry.com/auth",