Skip to content

Instantly share code, notes, and snippets.

View fmedlin's full-sized avatar

Fred Medlin fmedlin

View GitHub Profile
@kconner
kconner / manx.sh
Last active August 14, 2023 15:20
manx [section] <page>: Creates and opens a PDF for a manpage
# Tested on macOS 13.
function manx {
if [ "$1" = "" ]; then
echo "manx [section] <page>: Creates and opens a PDF for a manpage."
else
pdfpath="/tmp/$*.man.pdf"
man -t $* | pstopdf -o "$pdfpath"; open "$pdfpath"
fi
}
@kconner
kconner / macOS Internals.md
Last active May 6, 2024 22:20
macOS Internals

macOS Internals

Understand your Mac and iPhone more deeply by tracing the evolution of Mac OS X from prelease to Swift. John Siracusa delivers the details.

Starting Points

How to use this gist

You've got two main options:

@flawyte
flawyte / Device.java
Last active April 7, 2024 15:28
How to get an Android device's serial number, visible to the user in "Settings > About phone/tablet/device > Status > Serial number".
import android.os.Build;
import java.lang.reflect.Method;
public class Device {
/**
* @return The device's serial number, visible to the user in {@code Settings > About phone/tablet/device > Status
* > Serial number}, or {@code null} if the serial number couldn't be found
*/
public static String getSerialNumber() {
@nightscape
nightscape / Example.java
Created October 21, 2016 19:59
Simple RxJava-based adapter for an Android RecyclerView
public class ReactiveTextViewHolder<T> extends ReactiveViewHolder<T> {
private TextView label;
private T currentItem;
public ReactiveTextViewHolder(View itemView) {
super(itemView);
label = (TextView) itemView.findViewById(android.R.id.text1);
}
@nolanlawson
nolanlawson / offline-first-tools.md
Last active March 16, 2024 15:46
List of offline-first tools for web developers

Offline-first tools for web developers

A quick list of tools for building HTML/CSS/JS apps that work well offline. Ping me at @nolanlawson if I missed anything!

Hybrid app development

Tools for bundling your HTML/CSS/JS into a native app.

@josh-burton
josh-burton / MergeRecyclerAdapter
Created August 26, 2014 20:38
A Merge Adapter for the RecyclerView. Based on CommonsWare cwac-merge and the MergedAdapter in the android sdk.
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
@Krylez-zz
Krylez-zz / ContentValuesBuilder.java
Last active December 17, 2015 21:39
ContentValuesBuilder.java
public class ContentValuesBuilder {
private ContentValues mValues;
private ContentValuesBuilder() {
mValues = new ContentValues();
}
public static ContentValuesBuilder newBuilder() {
return new ContentValuesBuilder();
}
@Krylez-zz
Krylez-zz / UIUtils.java
Last active December 17, 2015 17:59
Better than findViewById
public class UIUtils {
public static <T extends View> T findView(View root, int id) {
return (T) root.findViewById(id);
}
}
@cyrilmottier
cyrilmottier / LicensesActivity.java
Created November 21, 2012 11:10
"Open source licenses" screen
package com.cyrilmottier.android.citybikes;
import android.os.Bundle;
import com.cyrilmottier.android.avelov.R;
import com.cyrilmottier.android.citybikes.app.BaseActivity;
public class LicensesActivity extends BaseActivity {
private WebView mWebView;