Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
function avoid_conflict {
if [ -f "$1" ]; then
git checkout "$2"
git mv "$1" "$3/"
git commit -am 'Move file into subdirectory.'
fi
}
require 'date'
class FirebasePush
PUSH_CHARS = '-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz'
def initialize
@prev_ts = 0
@rand_chars = Array.new(12)
end
@azell
azell / Gemfile
Last active August 29, 2015 14:12 — forked from mebezac/Gemfile
gem 'foreman'
gem 'puma'
public <T> T execute(Function<DSLContext,T> fun) {
T result = null;
Connection connection = null;
DatabaseException userException = null;
try {
connection = dataSource.getConnection();
connection.setAutoCommit(false);
package com.firebase.client;
import com.firebase.client.core.Constants;
import rx.Observable;
import rx.Subscriber;
import rx.functions.Action0;
import rx.functions.Func1;
import rx.subscriptions.Subscriptions;
public class RxFirebase {
@azell
azell / string-value
Created December 2, 2013 07:29
Multi-field and string type with embedded value not working as expected
curl -XDELETE localhost:9200/test
curl -XPUT localhost:9200/test -d '{
"mappings" : {
"type1" : {
"properties" : {
"name" : {
"type" : "multi_field",
"fields" : {
"name" : {"type" : "string", "index" : "analyzed"},
@azell
azell / string_type
Created December 2, 2013 07:27
Multi-field and string type working as expected
curl -XDELETE localhost:9200/test
curl -XPUT localhost:9200/test -d '{
"mappings" : {
"type1" : {
"properties" : {
"name" : {
"type" : "multi_field",
"fields" : {
"name" : {"type" : "string", "index" : "analyzed"},
{
"chat": {
// the list of chats may not be listed (no .read permissions here)
// a chat conversation
"$key": {
// if the chat hasn't been created yet, we allow read so there is a way
// to check this and create it; if it already exists, then authenticated
// user (specified by auth.id) must be in $key/users
{
"chat": {
// the list of chats may not be listed (no .read permissions here)
// a chat conversation
"$key": {
// if the chat hasn't been created yet, we allow read so there is a way
// to check this and create it; if it already exists, then authenticated
// user (specified by auth.id) must be in $key/users
@azell
azell / gist:5704171
Last active December 18, 2015 01:29
Tables:
CREATE TABLE "activities" (
"id" INT UNSIGNED NOT NULL AUTO_INCREMENT,
...
);
CREATE TABLE "interests" (
"id" INT UNSIGNED NOT NULL AUTO_INCREMENT,
"name" VARCHAR(255) NOT NULL,