Skip to content

Instantly share code, notes, and snippets.

View gurpreet-'s full-sized avatar
💥
throw new GitHubStatusException();

Gurpreet Paul gurpreet-

💥
throw new GitHubStatusException();
View GitHub Profile
@gurpreet-
gurpreet- / DetectAndroidKeyboardHiddenOrShownRxJava.java
Last active June 29, 2018 13:58
Detect when the Android soft keyboard is shown or hidden
/*
* Copyright (c) Terl Tech Ltd • 29/06/18 14:03 • goterl.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@gurpreet-
gurpreet- / SetNewObjectDefaults.java
Created March 8, 2018 00:47
Making Apache Cayenne respect default values in Postgres
/**
* Modified from http://objectstyle.org/cayenne/lists/cayenne-user/2007/12/0084.html
* for use with Postgres. However, it performs many SELECTs which may or may not be
* efficient depending on your application.
*/
private void setNewObjectDefaults() {
BaseDataObject mainObj = (BaseDataObject) this;
ObjEntity ent = Cayenne.getObjEntity(mainObj);
Collection attribs = ent.getAttributes();
@gurpreet-
gurpreet- / Main.java
Last active January 28, 2020 18:34
Sending "Hello" from Android or Java to Primus in binary or string form
package com.company;
import com.neovisionaries.ws.client.*;
import java.io.IOException;
import java.util.Date;
import java.util.List;
import java.util.Map;
public class Main extends Thread {