Skip to content

Instantly share code, notes, and snippets.

View ericharlow's full-sized avatar

Eric Harlow ericharlow

View GitHub Profile
@ok3141
ok3141 / android-vector-drawable-to-svg.xsl
Last active May 30, 2023 02:58
Convert Android Vector Drawable to SVG with XSLT
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
<xsl:template match="/">
<svg xmlns="http://www.w3.org/2000/svg">
<xsl:attribute name="width">
<xsl:value-of select="substring-before(vector/@width, 'dp')"/>
</xsl:attribute>
<xsl:attribute name="height">
<xsl:value-of select="substring-before(vector/@height, 'dp')"/>
</xsl:attribute>
/*
* Copyright (C) 2016 Jeff Gilfelt.
*
* 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
@hrules6872
hrules6872 / TextViewDrawableSize.java
Last active September 8, 2022 12:22
TextViewDrawableSize - CompoundDrawable size
public class TextViewDrawableSize extends TextView {
private static final int DEFAULT_COMPOUND_DRAWABLE_SIZE = -1;
private int compoundDrawableWidth;
private int compoundDrawableHeight;
public TextViewDrawableSize(Context context) {
this(context, null);
}
public TextViewDrawableSize(Context context, AttributeSet attrs) {
@davidtheclark
davidtheclark / isElementInViewport.js
Created May 4, 2013 02:00
JavaScript: Is element in viewport?
/*
No jQuery necessary.
Thanks to Dan's StackOverflow answer for this:
http://stackoverflow.com/questions/123999/how-to-tell-if-a-dom-element-is-visible-in-the-current-viewport
*/
function isElementInViewport(el) {
var rect = el.getBoundingClientRect();
return (
rect.top >= 0 &&