Skip to content

Instantly share code, notes, and snippets.

View sirvon's full-sized avatar

SirVon Thomas sirvon

  • XNA Inc.
  • California, USA
View GitHub Profile
@deflomu
deflomu / install_android_sdk
Last active August 29, 2015 13:57
Simple Android SDK Installation Script for Debian Based Systems
#!/bin/bash
#
# Inspired by https://gist.github.com/tahl/1026610
#
# Installes the android-sdk only.
read -p "Some steps of this script need sudo: Installing ia32-libs if needed. Creating udev rules.
Do you wat to continue? [Y/n]" response
case $response in
@menny
menny / build.gradle
Last active August 29, 2015 14:00
Shippable for _Android_ Projects
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.9.+'
classpath 'com.jakewharton.sdkmanager:gradle-plugin:0.9.+'
}
}
@garymabin
garymabin / AnimatedGifDrawable
Created January 29, 2015 02:36
gif image utils
import java.io.InputStream;
import android.graphics.Bitmap;
import android.graphics.drawable.AnimationDrawable;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
public class AnimatedGifDrawable extends AnimationDrawable {
private int mCurrentIndex = 0;
@ToeJamson
ToeJamson / 1.java
Created August 5, 2015 15:51
Connected Car Tech Preview: Android Auto and PubNub
private Pubnub pubnub;
protected void initPubnub() {
Pubnub pubnub = new Pubnub("demo", "demo");
try {
// subscribe methods here
} catch (Exception e) {
Log.d(“PUBNUB”,e.toString());
}
}
@imminent
imminent / banner_image_view.xml
Created December 17, 2012 18:07
set height ImageView stetches image to fit width while maintaining aspect ratio. Centers the stretched image in the window of the ImageView.
<ImageView
android:id="@+id/header_background"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_alignBottom="@+id/avatar"
android:paddingTop="8dp"
android:scaleType="centerCrop"
android:cropToPadding="true"
android:adjustViewBounds="true"
android:src="@drawable/anonymous_image_2"
@stephenlb
stephenlb / calculate-payload-size.js
Last active January 2, 2016 04:19
Calculating a PubNub Message Payload Size. This is necessary to prevent yourself from getting a "Message Too Large" gateway response.
(function(){
// Calculating a PubNub Message Payload Size.
function calculate_payload_size( channel, message ) {
return encodeURIComponent( channel + JSON.stringify(message) ).length + 97;
}
})();

Android Studio's Android SDK Location

/Users/[Username]/Library/Android/sdk

Don't have a Homebrew managed NPM

Homebrew is a handy tool for installing applications on OS X that aren't available in the app store. The downside is having a package manager handle another package manager with different opinions on architecture gets hairy, and your NPM installation will have reliability issues in the future if you install Node with Homebrew. However if you're on Windows you shouldn't have an issue using Chocolatey.

The most robust way to install Node is by installing it under NVM (Node Version Manager). If you already have NVM, or have a version of Node 4+ installed from other means (not Homebrew), you can skip to Step 2.

Uninstall Previous Node Installation

You can uninstall an existing version of node by following the advice in this gist, supplied for brevity here:

@yarbelk
yarbelk / export_github_issues.py
Created December 28, 2012 10:38
a command line utility to export github issues. requires the `requests` library.
#!/usr/bin/env python
# export github issues to a csv file
import json
import requests
import csv
import getpass
from StringIO import StringIO
import argparse
import sys
@sirvon
sirvon / TwitterVideoApiClient.class
Created January 10, 2016 17:51
upload video to twitter via android client
public class TwitterVideoApiClient extends TwitterApiClient{
private static final String TWITTER_UPLOAD_URL = "https://upload.twitter.com";
private RestAdapter twitterVideoApiClientAdapter;
public TwitterVideoApiClient(TwitterSession session) {
@memfis19
memfis19 / RealmManager.java
Created April 6, 2017 06:42 — forked from Zhuinden/RealmManager.java
Thread-local Realm
@Singleton
public class RealmManager {
private ThreadLocal<Realm> realms;
@Inject
public RealmManager() {
realms = new ThreadLocal<>();
}
public Realm openRealm() {