Skip to content

Instantly share code, notes, and snippets.

@michiel
michiel / keycloak.sh
Created May 13, 2016 15:01 — forked from paoloantinori/keycloak.sh
Keycloak Admin API Rest Example
#!/bin/bash
export TKN=$(curl -X POST 'http://localhost:8080/auth/realms/master/protocol/openid-connect/token' \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "username=admin" \
-d 'password=admin' \
-d 'grant_type=password' \
-d 'client_id=admin-cli' | jq -r '.access_token')
curl -X GET 'http://localhost:8080/auth/admin/realms' \
@michiel
michiel / rethinkdb-getall.md
Created February 15, 2016 10:10 — forked from coffeemug/rethinkdb-getall.md
Using the `getAll` command to query multiple keys in RethinkDB 1.7.

Querying by multiple keys

The previous releases of RethinkDB allowed querying indexes as follows:

// Three ways to get the user with primary key 5
r.table('users').get(5)
r.table('users').getAll(5)
r.table('users').getAll(5, {index: 'id'})
@michiel
michiel / kafka-consumer.java
Created October 11, 2015 17:46 — forked from terrancesnyder/kafka-consumer.java
Simple example of publishing avro messages to Kafka.
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import org.apache.avro.io.BinaryDecoder;
import org.apache.avro.io.BinaryEncoder;
import org.apache.avro.io.DecoderFactory;
#!/bin/sh
### BEGIN INIT INFO
# Provides: playframework
# Required-Start: $local_fs $remote_fs $network $syslog
# Required-Stop: $local_fs $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start/Stop playframework
### END INIT INFO
#
require('config/adapters/faye-adapter');
export default DS.FayeAdapter.extend();
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script src="http://d3js.org/d3.v2.js"></script>
<link href="styles.css" rel="stylesheet" type="text/css" />
<title>"Percent complete" bar</title>
</head>
#
# A CORS (Cross-Origin Resouce Sharing) config for nginx
#
# == Purpose
#
# This nginx configuration enables CORS requests in the following way:
# - enables CORS just for origins on a whitelist specified by a regular expression
# - CORS preflight request (OPTIONS) are responded immediately
# - Access-Control-Allow-Credentials=true for GET and POST requests

Ace editor component for Ember.

  • A two-way binding is set up between value and the text in the editor.
  • Configure Ace in the aceInit callback.

Template

{{ace-editor value=value aceInit=aceInit class="editor"}}