Skip to content

Instantly share code, notes, and snippets.

Avatar

Dmitriy Kazimirov intari

View GitHub Profile
View 99java
## Setup java
if [ `uname -m` == 'x86_64' ]; then
PATH="/usr/lib64/jvm/java-7-oracle/jre/bin/"
JAVA_HOME="/usr/lib64/jvm/java-7-oracle/"
else
PATH="/usr/lib/jvm/java-7-oracle/jre/bin/"
JAVA_HOME="/usr/lib/jvm/java-7-oracle/"
fi
View AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.novoda.espresso">
<!-- For espresso testing purposes, this is removed in live builds, but not in dev builds -->
<uses-permission android:name="android.permission.SET_ANIMATION_SCALE" />
<!-- ... -->
View AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.novoda.espresso">
<!-- For espresso testing purposes, this is removed in live builds, but not in dev builds -->
<uses-permission android:name="android.permission.SET_ANIMATION_SCALE" />
<!-- ... -->
@intari
intari / rescuetime_hg_commit_hook
Created May 25, 2015
Commit hook to log commit messages as highlights to RescueTime
View rescuetime_hg_commit_hook
#!/bin/sh
#
# Log commit messages as a 'highlight' in RescueTime Premium for Mercurial
#
# To enable this hook:
#
# 1. Get your API key from https://www.rescuetime.com/integrations/git
# 2. Place this file somewhere
# 3. Make sure it has executable permissions (chmod +x post-commit)
# 4. add line commit=path/to/this to [hooks] session of your .hgrc
@intari
intari / DrawerItemWithBadgeInCircle.java
Created Jun 11, 2015
Make it possible to use custom centered background resource in MaterialDrawer library
View DrawerItemWithBadgeInCircle.java
package com.viorsan.gists.example1
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
View dkzm_build.sh
#!/bin/bash
ant clean
ant release
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore $ANDROID_KEYSTORE -storepass $ANDROID_STORE_PASS ~/Documents/Work/FBReader-for-Android/bin/FBReaderJ-release-unsigned.apk key0
rm ~/Documents/Work/FBReader-for-Android/FBReaderJ-release.apk
~/Library/Android/sdk/build-tools/21.1.2/zipalign -v 4 ~/Documents/Work/FBReader-for-Android/bin/FBReaderJ-release-unsigned.apk ~/Documents/Work/FBReader-for-Android/FBReaderJ-release.apk
jarsigner -verify -certs ~/Documents/Work/FBReader-for-Android/FBReaderJ-release.apk
#submit to HockeyApp
puck -submit=auto ~/Documents/Work/FBReader-for-Android/FBReaderJ-release.apk
@intari
intari / Singleton.h
Created Feb 16, 2016 — forked from virasio/Singleton.h
Singleton (Objective-C with ARC)
View Singleton.h
@interface MySingleton : NSObject
// ...
+ (instancetype) sharedInstance;
+ (instancetype) alloc __attribute__((unavailable("alloc not available, call sharedInstance instead")));
- (instancetype) init __attribute__((unavailable("init not available, call sharedInstance instead")));
+ (instancetype) new __attribute__((unavailable("new not available, call sharedInstance instead")));
@intari
intari / gist:33b82cabd42ec9034dd50786f1b2f785
Created Aug 13, 2016 — forked from alloy/gist:4952606
Upload iOS application for clients on their iTunes Connect account.
View gist:33b82cabd42ec9034dd50786f1b2f785

Obviously, the simplest solution would be for the client to share their account details or add us as ‘team admin’, but that is not what this is about.

On https://developer.apple.com

  1. [Add us to your iOS Developer Program as ‘team member’.][1]
  2. [Create a ‘Distribution Certificate’, if you haven’t got one already.][2]
  3. [Create a ‘App Store Distribution Provisioning Profile’.][3]
  4. [Export the ‘Distribution Certificate’ assets and send the export and password to us.][4] (For security sake, it’s a good idea to send us the password via other means than the exported certificate. E.g. by phone/SMS.)

On https://itunesconnect.apple.com

@intari
intari / OkHttp3Stack.java
Last active May 15, 2020
OkHttp3Stack.java with Stetho support
View OkHttp3Stack.java
package com.viorsan.test.android.Utils;
/**
* The MIT License (MIT)
*
* Copyright (c) 2015 Circle Internet Financial
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
View service.java
protected var locationServiceConnection: ServiceConnection = object : ServiceConnection {
override fun onServiceConnected(className: ComponentName, service: IBinder) {
// This is called when the connection with the service has been
// established, giving us the service object we can use to
// interact with the service. Because we have bound to a explicit
// service that we know is running in our own process, we can
// cast its IBinder to a concrete class and directly access it.
//locationService=(MySLocationService.LocalBinder)service;
locationService = (service as MyLocationService.LocalBinder).service
You can’t perform that action at this time.