Skip to content

Instantly share code, notes, and snippets.

View afarber's full-sized avatar
🏠
Working from home

Alexander Farber afarber

🏠
Working from home
View GitHub Profile
@afarber
afarber / SeekBarPreference.java
Last active August 29, 2015 14:21
SeekBarPreference for Android: inline (not dialog-based) and saves slider progress as integer
import android.content.Context;
import android.content.res.TypedArray;
import android.preference.Preference;
import android.util.AttributeSet;
import android.view.View;
import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener;
public class SeekBarPreference extends Preference implements OnSeekBarChangeListener {
private SeekBar mSeekBar;
@afarber
afarber / NumberPickerPreference.java
Last active April 30, 2018 17:51
NumberPickerPreference for Android: saves number picker value as integer
import android.content.Context;
import android.content.res.TypedArray;
import android.preference.DialogPreference;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.view.View;
import android.widget.NumberPicker;
import android.widget.TextView;
public class NumberPickerPreference extends DialogPreference {
@afarber
afarber / sender.php
Last active August 29, 2015 14:27 — forked from mstrengis/sender.php
JAXL PHP XMPP Google Cloud Messages impl
<?
/*
This uses JAXL lib https://github.com/jaxl/JAXL/releases/tag/v3.0.0
Changes for JAXL lib are...
lib/jaxl/jaxl.php ~ #358
public function get_socket_path() { //Force ssl
return ($this->cfg['port'] == 5235 || $this->cfg['port'] == 5236 ? "ssl" : "tcp")."://".$this->cfg['host'].":".$this->cfg['port'];
}
import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentSender;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.Fragment;
import android.util.Log;
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<group android:id="@+id/my_move" android:checkableBehavior="single">
<item
android:id="@+id/game1"
android:icon="@drawable/ic_stars_black_24dp"
android:title="Game #1" />
<item
android:id="@+id/game2"
@afarber
afarber / words.sql
Last active October 31, 2016 12:45
DROP TABLE IF EXISTS words_scores;
DROP TABLE IF EXISTS words_chat;
DROP TABLE IF EXISTS words_notes;
DROP TABLE IF EXISTS words_moves;
DROP TABLE IF EXISTS words_games;
DROP TABLE IF EXISTS words_social;
DROP TABLE IF EXISTS words_users;
DROP TABLE IF EXISTS words_nouns;
DROP TABLE IF EXISTS words_verbs;
DROP TABLE IF EXISTS words_values;
@afarber
afarber / merge.sql
Last active February 27, 2016 18:55
Merge records belonging to same user - without losing payment or punishment information: http://stackoverflow.com/questions/35673982/using-jsonb-array-elements-with-where-in-condition
DROP TABLE IF EXISTS users;
CREATE TABLE users (
uid SERIAL PRIMARY KEY,
paid1_until timestamptz NULL,
paid2_until timestamptz NULL,
banned_until timestamptz NULL,
banned_reason varchar(255) NULL
);
# java -Dorg.eclipse.jetty.LEVEL=DEBUG -jar /Users/afarber/jetty-distribution-9.3.10.v20160621/start.jar jetty.base=/Users/afarber/jetty-base
2016-07-02 16:24:54.864:INFO::main: Logging initialized @487ms
2016-07-02 16:24:54.903:DBUG:oejx.XmlParser:main: parse: file:/Users/afarber/jetty-distribution-9.3.10.v20160621/etc/jetty.xml
2016-07-02 16:24:54.906:DBUG:oejx.XmlParser:main: parsing: sid=file:/Users/afarber/jetty-distribution-9.3.10.v20160621/etc/jetty.xml,pid=null
2016-07-02 16:24:54.916:DBUG:oejx.XmlParser:main: resolveEntity(-//Jetty//Configure//EN, http://www.eclipse.org/jetty/configure_9_3.dtd)
2016-07-02 16:24:54.916:DBUG:oejx.XmlParser:main: Redirected entity http://www.eclipse.org/jetty/configure_9_3.dtd --> jar:file:/Users/afarber/jetty-distribution-9.3.10.v20160621/lib/jetty-xml-9.3.10.v20160621.jar!/org/eclipse/jetty/xml/configure_9_3.dtd
2016-07-02 16:24:54.978:DBUG:oejuc.ContainerLifeCycle:main: org.eclipse.jetty.server.Server@5aaa6d82 added {qtp1993134103{STOPPED,8<=0<=200,i=0,q=0},AUTO}
20
@afarber
afarber / 2016_07_13.stderrout.log
Created July 13, 2016 19:24
jetty-distribution-9.3.10.v20160621
This file has been truncated, but you can view the full file.
2016-07-13 21:02:51.898:DBUG:oejx.XmlConfiguration:main: XML call setOut
2016-07-13 21:02:51.898:DBUG:oejx.XmlParser:main: parse: file:/usr/share/java/jetty-distribution-9.3.10.v20160621/etc/jetty.xml
2016-07-13 21:02:51.898:DBUG:oejx.XmlParser:main: parsing: sid=file:/usr/share/java/jetty-distribution-9.3.10.v20160621/etc/jetty.xml,pid=null
2016-07-13 21:02:51.898:DBUG:oejx.XmlParser:main: resolveEntity(-//Jetty//Configure//EN, http://www.eclipse.org/jetty/configure_9_3.dtd)
2016-07-13 21:02:51.898:DBUG:oejx.XmlParser:main: Redirected entity http://www.eclipse.org/jetty/configure_9_3.dtd --> jar:file:/usr/share/java/jetty-distribution-9.3.10.v20160621/lib/jetty-xml-9.3.10.v20160621.jar!/org/eclipse/jetty/xml/configure_9_3.dtd
2016-07-13 21:02:51.915:DBUG:oejuc.ContainerLifeCycle:main: org.eclipse.jetty.server.Server@41a4555e added {qtp212628335{STOPPED,8<=0<=200,i=0,q=0},AUTO}
2016-07-13 21:02:51.915:DBUG:oejx.XmlConfiguration:main: XML get ThreadPool
2016-07-13 21:02:51.917:DBUG:oejx.XmlConfiguration:main:
"use strict";
function Score(color) {
PIXI.Container.call(this);
this.color = color;
this.interactive = false;
this.buttonMode = false;
this.visible = false;