Skip to content

Instantly share code, notes, and snippets.

View mlc's full-sized avatar

mike castleman mlc

View GitHub Profile
@mlc
mlc / .XCompose
Created October 20, 2017 00:11
$HOME/.XCompose
# -*- coding: utf-8; mode: conf -*-
include "%L"
<Multi_key> <s> <h> <r> <u> <g>: "¯\\_(ツ)_/¯"
<Multi_key> <s> <a> <d>: "😿"
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns="http://www.topografix.com/GPX/1/1"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:date="http://exslt.org/dates-and-times"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
extension-element-prefixes="date">
<xsl:output method="xml" indent="yes" encoding="utf-8"/>
<xsl:template match="/index">
<gpx version="1.1" creator="flickrdownload-to-gpx" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd http://www.garmin.com/xmlschemas/GpxExtensions/v3">
@mlc
mlc / oulipo-link-shrinker.js
Last active April 27, 2017 13:50
javascript amazon lambda for https://oulipo.link/
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import com.google.common.base.Joiner;
import com.google.common.primitives.Ints;
import java.util.Arrays;
public class GrimePuz {
public static void main(String[] args) {
int[] n = new int[10];
int[] counts = new int[10];
n[0] = 1;
while (n[0] < 10) {
/**
* Attempts to set copy into a TextView using the normal copy. If it ends up
* wrapping onto more than one line, uses the short copy alternative instead.
* @param textView The TextView (or Button or whatever) to setText on.
* @param normalCopyResId The preferred copy string resource id.
* @param shortCopyResId The alternate (shorter) copy string resource id.
*/
public static void maybeUseShorterCopy(final TextView textView,
@StringRes final int normalCopyResId,
@StringRes final int shortCopyResId) {
@mlc
mlc / .XCompose
Created July 7, 2015 18:41
$HOME/.XCompose
# -*- coding: utf-8; mode: conf -*-
include "%L"
<Multi_key> <s> <h> <r> <u> <g>: "¯\\_(ツ)_/¯"
<Multi_key> <s> <a> <d>: "😿"
@mlc
mlc / gist:caf2ca1bd1261b908f14
Created June 21, 2014 05:25
testing form field escaping in multipart/form-data forms
<!DOCTYPE html>
<html>
<head>
<title>multipart test</title>
<meta charset='utf-8'>
</head>
<body>
<h1>multipart test</h1>
<form action='/test' enctype='multipart/form-data' method='post'>
<p>
@mlc
mlc / OkHttpOAuthConsumer.java
Created June 10, 2014 21:40
okhttp 2.0 + oauth signpost. extremely preliminary and not guaranteed.
import com.squareup.okhttp.Request;
import oauth.signpost.AbstractOAuthConsumer;
import oauth.signpost.http.HttpRequest;
public class OkHttpOAuthConsumer extends AbstractOAuthConsumer {
public OkHttpOAuthConsumer(String consumerKey, String consumerSecret) {
super(consumerKey, consumerSecret);
}
@Override
@mlc
mlc / README.md
Last active August 29, 2015 13:58