Skip to content

Instantly share code, notes, and snippets.

View Ithildir's full-sized avatar

Andrea Di Giorgi Ithildir

View GitHub Profile
@walshie4
walshie4 / exampleTransaction.js
Created July 20, 2018 01:14
How to properly use Google's Spanner nodejs client library to do a transactional update in a Promise workflow
import spanner from '@google-cloud/spanner';
const spannerOptions = {
min: 10,
max: 100,
};
// Pretend projectId is a variable with your project ID string in it
// and instanceName is a variable with your db instance name in it
// and databaseName is a variable with your db database name in it
const db = spanner({ projectId }).instance(instanceName).database(databaseName, spannerOptions);
@bmaupin
bmaupin / epub.css
Last active January 27, 2022 15:31
You Don't Know JS Ebooks
body {
text-align: justify;
}
code, pre {
font-family: "DejaVuSansMono", monospace;
}
h1, h2, h3, h4, h5, h6 {
text-align: left;
@cubehouse
cubehouse / FetchCharacterAppearances.js
Created January 31, 2017 18:34
Fetch Disney character appearances for Disneyland California using themeparks library
var ThemeParks = require("themeparks");
var MagicKingdom = new ThemeParks.Parks.DisneylandResortMagicKingdom();
// https://api.wdpro.disney.go.com/bulk-service/snapshot/DLR-mobile-character-appearances
// for reference: above URL requests these two URLs at the same time (hense the "bulk-service")
// https://api.wdpro.disney.go.com/global-pool-override-B/bulk-service/snapshot/DLR-mobile-dl-character-appearances
// https://api.wdpro.disney.go.com/global-pool-override-B/bulk-service/snapshot/DLR-mobile-ca-character-appearances
MagicKingdom.GetAPIUrl({
This file has been truncated, but you can view the full file.
⤷ ant all
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=768M; support was removed in 8.0
Buildfile: /Users/Cristina/Work/Code/liferay-portal/build.xml
all:
clean:
clean:
package vertx.proxy.issue.proxy.bottleneck;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@vital101
vital101 / nodegit.js
Created September 26, 2016 10:36
NodeGit Clone Private with Token
const repo = 'vital101/kernl-example-plugin-gitub';
const token = 'my-token-from-oauth';
const cloneURL = `https://${token}:x-oauth-basic@github.com/${repository}`;
const cloneOptions = {
fetchOpts: {
callbacks: {
certificateCheck: () => { return 1; },
credentials: () => {
return NodeGit.Cred.userpassPlaintextNew(token, 'x-oauth-basic');
}
@gamerson
gamerson / ArchetypeClient.java
Created August 16, 2016 04:04
ArchetypeClient
import java.io.File;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
import org.apache.maven.archetype.ArchetypeGenerationRequest;
import org.apache.maven.archetype.ArchetypeGenerationResult;
import org.apache.maven.archetype.DefaultArchetypeManager;
import org.apache.maven.archetype.common.ArchetypeFilesResolver;
@kenjiheigel
kenjiheigel / ci.xml
Last active October 10, 2018 17:24
Backend Test Results Generator
<?xml version="1.0"?>
<project basedir="." default="generate-backend-results" name="ci" xmlns:antelope="antlib:ise.antelope.tasks">
<import file="build-test.xml" />
<target name="prepare-classpath">
<gradle-execute dir="modules/test/jenkins-results-parser" task="jar" />
<copy todir="lib/development">
<fileset dir="tools/sdk/dist" includes="com.liferay.jenkins.results.parser*.jar" />
@Stwissel
Stwissel / AsyncInputStream.java
Last active March 11, 2024 10:21
AsyncInputStream for vert.x - Take 2
import java.io.IOException;
import java.io.InputStream;
import java.nio.ByteBuffer;
import java.nio.channels.Channels;
import java.nio.channels.ReadableByteChannel;
import io.vertx.core.AsyncResult;
import io.vertx.core.Context;
import io.vertx.core.Future;
import io.vertx.core.Handler;
  • Functional Programming is a model of programming that transform and compose stream of immutable sequences by applying map, filter and reduce. Events are immutable because you can't change history.
  • Reactive Programming is a model of programming focuses on data flow and change propagation.
  • ReactiveX is an API that focuses on asynchronous composition and manipulation of observable streams of data or events by using a combination of the Observer pattern, Iterator pattern, and features of Functional Programming.
  • RxJava is the open-source implementation of ReactiveX in Java.
  • RxJava is a Java VM implementation of ReactiveX (Reactive Extensions): a library for composing asynchronous and event-based programs by using observable sequences.
  • RxAndroid is a lightweight extension to RxJava that providers a Scheduler for Android’s Main Thread, as well as the ability to create a Scheduler that runs on any given Android Handler class.
  • The two main classes are Observable and Subscriber.
  • `O