Skip to content

Instantly share code, notes, and snippets.

View lynfogeek's full-sized avatar

Arnaud Camus lynfogeek

View GitHub Profile
import UIKit
extension UIImage {
// colorize image with given tint color
// this is similar to Photoshop's "Color" layer blend mode
// this is perfect for non-greyscale source images, and images that have both highlights and shadows that should be preserved
// white will stay white and black will stay black as the lightness of the image is preserved
func tint(tintColor: UIColor) -> UIImage {
@lynfogeek
lynfogeek / markdown.md
Last active July 5, 2016 11:35 — forked from jonschlinkert/markdown-cheatsheet.md
Simplified markdown cheat sheet

Typography

Emphasis

Bold

For emphasizing a snippet of text with a heavier font-weight.

The following snippet of text is rendered as bold text.

@lynfogeek
lynfogeek / InitialDrawable.java
Last active August 12, 2016 03:56
InitialDrawable: A contact-like drawable to display up to 2 letters in a colored circle
public class InitialDrawable extends ShapeDrawable {
private final Paint textPaint;
private final Paint borderPaint;
private static final float SHADE_FACTOR = 0.9f;
private final String text;
private final int color;
private final int height;
private final int width;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.layoutfab);
//Outline
final int size = getResources().getDimensionPixelSize(R.dimen.fab_size);
findViewById(R.id.fab).setOutlineProvider(new ViewOutlineProvider() {
@lynfogeek
lynfogeek / gist:d5f5cb5101dd5831e737
Created October 13, 2014 13:55
A QuoteSpan-like Span with a customisable margin between the border and the text.
/**
* Created by Arnaud CAMUS on 13/10/2014.
*
* Creates a QuoteSpan-like Span with a customisable margin between
* the border and the text.
*/
public class QuoteWithMarginSpan implements LeadingMarginSpan, ParcelableSpan {