Skip to content

Instantly share code, notes, and snippets.

View donnfelker's full-sized avatar

Donn Felker donnfelker

View GitHub Profile
@donnfelker
donnfelker / CustomBindingAdapters.kt
Last active October 20, 2017 11:12
MVVM - Removing Logic from Your Views with BindingAdapters
@BindingAdapter(“isVisible”)
fun setIsVisible(view: View, isVisible: Boolean) {
if (isVislble) {
view.visibility = View.VISIBLE
} else {
view.visibility = View.GONE
}
}
@donnfelker
donnfelker / encoding-video.md
Created July 13, 2017 17:35 — forked from Vestride/encoding-video.md
Encoding video for the web

Encoding Video

Installing

Install FFmpeg with homebrew. You'll need to install it with a couple flags for webm and the AAC audio codec.

brew install ffmpeg --with-libvpx --with-libvorbis --with-fdk-aacc --with-opus
@donnfelker
donnfelker / circle.yml
Created December 13, 2016 13:05
Updated circle.yml file for Caster.IO
#
# Build configuration for Circle CI
#
# See this thread for speeding up and caching directories:
# https://discuss.circleci.com/t/installing-android-build-tools-23-0-2/924
#
general:
artifacts:
- /home/ubuntu/AndroidCI/app/build/outputs/apk/
@donnfelker
donnfelker / friendly_urls.markdown
Created August 26, 2016 20:54 — forked from jcasimir/friendly_urls.markdown
Friendly URLs in Rails

Friendly URLs

By default, Rails applications build URLs based on the primary key -- the id column from the database. Imagine we have a Person model and associated controller. We have a person record for Bob Martin that has id number 6. The URL for his show page would be:

/people/6

But, for aesthetic or SEO purposes, we want Bob's name in the URL. The last segment, the 6 here, is called the "slug". Let's look at a few ways to implement better slugs.

@donnfelker
donnfelker / config
Last active November 19, 2019 11:28
Watch or Unwatch a file in git
# Goes in your .git/config file
[alias]
# Temporarily stop tracking a file in git.
# usage: git unwatch path/to/file
unwatch = update-index --assume-unchanged
# Resume tracking a file in git.
# usage: git watch path/to/file
watch = update-index --no-assume-unchanged
@donnfelker
donnfelker / circle.yml
Created June 2, 2016 16:05
Updated circle.yml file
#
# Build configuration for Circle CI
#
# See this thread for speeding up and caching directories: https://discuss.circleci.com/t/installing-android-build-tools-23-0-2/924
#
general:
artifacts:
- /home/ubuntu/AndroidCI/app/build/outputs/apk/
@donnfelker
donnfelker / OrderActivity.java
Last active November 22, 2019 23:46
RxJava Bound Service AIDL Abstraction
package com.donnfelker.rxexample;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import rx.Subscriber;
import rx.Subscription;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;
@donnfelker
donnfelker / android-19-circle.yml
Last active March 12, 2021 13:19
Sample CircleCI Configuration For an Android App
#
# Build configuration for Circle CI
#
general:
artifacts:
- /home/ubuntu/your-app-name/app/build/outputs/apk/
machine:
environment:
@donnfelker
donnfelker / CircularTransformation.java
Last active December 2, 2020 20:47
Picasso and CircularTransform Example
import android.graphics.*;
import com.squareup.picasso.Transformation;
/**
* Transforms an image into a circle representation. Such as a avatar.
*/
public class CircularTransformation implements Transformation
{
int radius = 10;
@donnfelker
donnfelker / build.gradle
Last active January 12, 2024 17:49
gradle properties in Android Studio
// Other build stuff
task ndkBuild(type:Exec) {
if(androidNdkPath != null) {
def ndkBuild = new File(androidNdkPath, 'ndk-build')
commandLine ndkBuild
} else {
// do something else
}
}