Skip to content

Instantly share code, notes, and snippets.

View natebass's full-sized avatar
🚂
Working on [opensac.org](https://github.com/code4sac/opensac.org)

Nate natebass

🚂
Working on [opensac.org](https://github.com/code4sac/opensac.org)
View GitHub Profile
@natebass
natebass / shake.xml
Created November 19, 2014 22:54
Shake Animation - Android
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/linear_interpolator">
<scale
android:fromXScale="1.0"
android:toXScale="0.8"
android:fromYScale="1.0"
android:toYScale="1.2"
android:pivotX="50%"
android:pivotY="50%"
@natebass
natebass / ItemDetailActivity.java
Created November 27, 2014 00:10
Android Studio Master/Detail Flow Template
package com.natebass.thefrag2;
import android.content.Intent;
import android.os.Bundle;
import android.app.Activity;
import android.view.MenuItem;
/**
@natebass
natebass / Api Query
Last active August 29, 2015 14:10
Query the OpenWeatherMap API
/*
* From the Udacity course "Developing Android Applications" Lesson 2
*/
// These two need to be declared outside the try/catch
// so that they can be closed in the finally block.
HttpURLConnection urlConnection = null;
BufferedReader reader = null;
// Will contain the raw JSON response as a string.
@natebass
natebass / parse.java
Created December 1, 2014 20:18
JSON Parsing
/* The date/time conversion code is going to be moved outside the asynctask later,
* so for convenience we're breaking it out into its own method now.
*/
private String getReadableDateString(long time){
// Because the API returns a unix timestamp (measured in seconds),
// it must be converted to milliseconds in order to be converted to valid date.
Date date = new Date(time * 1000);
SimpleDateFormat format = new SimpleDateFormat("E, MMM d");
return format.format(date).toString();
@natebass
natebass / bounce.java
Created December 11, 2014 00:17
Bounce animation with ValueAnimator
package com.natebass.bouncingballs;
import android.animation.ValueAnimator;
import android.app.Activity;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.os.Bundle;
@natebass
natebass / BouncingBalls.java
Created December 13, 2014 23:54
Multiple properties on multiple balls.
package com.natebass.learn2draw;
import android.animation.Animator;
import android.animation.Keyframe;
import android.animation.PropertyValuesHolder;
import android.app.Activity;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.RadialGradient;
@natebass
natebass / manifest.json
Last active August 29, 2015 14:11
Ubuntu Chrome Theme
// frame.jpg is 1000 x 120 of plain #3b3c37
{
"name": "Ubuntu",
"manifest_version": 2,
"version": "2.6",
"theme": {
"colors": {
"tab_text": [ 223, 219, 210 ],
"tab_background_text": [ 120, 127, 109 ],
"bookmark_text": [ 223, 219, 210 ],
@natebass
natebass / awk_tables.sh
Last active August 29, 2015 14:12
Format data into Github Markdown tables
awk -F' ' '
BEGIN {
FIRST_COL_LENGTH = 4;
SECOND_COL_LENGTH = 80;
THIRD_COL_LENGTH = 35;
printf("|%4s|%80s|%35s|\n", "Key", "Action", "Followed By")
printf("|")
for (i=0; i<FIRST_COL_LENGTH; i++) {
printf("-");
}
@natebass
natebass / shortcuts_terminal.md
Last active March 15, 2018 12:50
Terminal Shortcuts

Bash Keyboard Shortcuts

Mon Dec 29 19:53:08 PST 2014 Link

Moving the cursor:

Keys Description
Ctrl + a Go to the beginning of the line (Home)
@natebass
natebass / shortcuts_intellij.md
Created December 30, 2014 18:37
Intellij Cheatsheet

Ctrl + Space | Basic code completion (the name of any class, method or variable) Ctrl + Shift + Space | Smart code completion (filters the list of methods and variables by expected type) Ctrl + Shift + Enter | Complete statement Ctrl + P | Parameter info (within method call arguments) Ctrl + Q | Quick documentation lookup Shift + F1 | External Doc Ctrl + mouse | over code Brief Info Ctrl + F1 | Show descriptions of error or warning at caret Alt + Insert | Generate code... (Getters, Setters, Constructors, hashCode/equals, toString) Ctrl + O | Override methods Ctrl + I | Implement methods