Skip to content

Instantly share code, notes, and snippets.

Georgi Mirchev n0m0r3pa1n

Block or report user

Report or block n0m0r3pa1n

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:cc09d3b931f010ee0ccf
private static final String DATABASE_NAME = "BGHISTORY_v3";
private static final String DATABASE_PATH = "/data/data/com.nmp90.bghistory/databases/";
private void copyDataBase() throws IOException {
//Open your local db as the input stream
InputStream myInput = myContext.getAssets().open(DATABASE_NAME);
// Path to the just created empty db
String outFileName = DATABASE_PATH + DATABASE_NAME;
View gist:956725eb5912f07002e5
//This method is supposed to tell the sockets server
//to post an refresh event with data to a selected client id
export function* postRefreshEvent(clientId, data) {
var connection = require('socket.io-emitter')({ host: '127.0.0.1', port: 8081 });
connection.emit('refresh', clientId, data);
return {statusCode: OK}
}
// Websockets
View Redux.md

Redux Rules

  1. Immutable state - it should not be changeable instead is replaced. Everything that changes in your app including the date and the UI state is stored in a single object tree.
  2. State is read only - to make a change you need to dispatch an action. An action is a plain javascript object. State = data, change = action

Pure vs Impure functions

  1. Pure 2. Depend only on their input params 3. Some value for some input elements
@n0m0r3pa1n
n0m0r3pa1n / dev-toolbox-2016.md
Created Apr 1, 2017
Android Developer Toolbox - Notes
View dev-toolbox-2016.md

Android Developer Toolbox - Notes

Gradle

  • Create different build variants which contain different code of your app
    • Internal - for the company. Embed a lot of tools to locate issues easily.
    • Production - only for customers

U+2020 application

View Effective Java Notes.md

Effective Java Notes

Creating and Destroying Objects

Item 1: Consider static factory methods instead of constructors

  • One advantage of static factory methods is that, unlike constructors, they have names
  • A second advantage of static factory methods is that, unlike constructors, they are not required to create a new object each time they’re invoked
  • A third advantage of static factory methods is that, unlike constructors, they can return an object of any subtype of their return type
  • The main disadvantage of providing only static factory methods is that classes without public or protected constructors cannot be subclassed
You can’t perform that action at this time.