Skip to content

Instantly share code, notes, and snippets.

@jgilfelt
jgilfelt / ExpandingListView.java
Created November 6, 2013 19:03
Fixes for Daniel Olshansky's DevByte example "ListView Expanding Cells Animation" (lines 130-132), also adds compatibility back to API 11. http://www.youtube.com/watch?v=mwE61B56pVQ http://developer.android.com/shareables/devbytes/ListViewExpandingCells.zip
/*
* Copyright (C) 2013 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@lesleh
lesleh / TopCropImageView.java
Last active September 16, 2017 04:15
ImageView that scales like centerCrop, but instead of showing the centre of the image, it shows the top.
import android.content.Context;
import android.graphics.Matrix;
import android.util.AttributeSet;
import android.widget.ImageView;
/**
* ImageView that scales like centerCrop, but instead of showing the centre of the image, it shows the top.
*/
public class TopCropImageView extends ImageView {
public TopCropImageView(Context context) {
@Hexcles
Hexcles / vpn-dorm.sh
Created September 14, 2013 15:15
ZJU Zijingang Campus dormitory VPN dial up script (xl2tpd + systemd, for Archlinux)
#!/bin/bash
PPP_TIMEOUT=30
L2TPD_TIMEOUT=5
L2TPD_CONTROL_FILE=/var/run/xl2tpd/l2tp-control
VPN_ACCOUNT=zjuvpn
function start_xl2tpd
{
systemctl start xl2tpd
@lembacon
lembacon / luna_pinyin.emoji.dict.yaml
Last active November 20, 2023 16:09
Pinyin-Emoji Dictionary for Squirrel
# Rime dictionary
# encoding: utf-8
---
name: luna_pinyin.emoji
version: "2017.02.10"
sort: by_weight
use_preset_vocabulary: true
...
@mosabua
mosabua / gist:1316903
Created October 26, 2011 16:28
ExpandableListFragment
package android.support.v4.app;
import android.os.Bundle;
import android.os.Handler;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnCreateContextMenuListener;
@clintel
clintel / gist:1155906
Created August 19, 2011 02:40
Fenced code in bullet lists with GitHub-flavoured MarkDown??

Fenced code blocks inside ordered and unordered lists

  1. This is a numbered list.

  2. I'm going to include a fenced code block as part of this bullet:

    Code
    More Code