This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def print_model(object): | |
print "\033[96m<{0}>\033[0m".format(wp.__class__.__name__) | |
for field in object._meta.fields: | |
if field.value_to_string(object) != 'None' and field.value_to_string(object) != '': | |
print "\033[94m{0:30}\033[0m \033[93m{1}\033[0m".format(field.name, field.value_to_string(object)) | |
else: | |
print "{0:30} {1}".format(field.name, field.value_to_string(object)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// true if display none or visibility hidden | |
function isVisible(el) { | |
var style = window.getComputedStyle(el); | |
return (style.display !== 'none') | |
} | |
// return true if element is in the window bounds or false if outside | |
function isInWindow(el) { | |
var viewportOffset = el.getBoundingClientRect(); | |
// these are relative to the viewport |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# gitignore function working with gitignore.io | |
function gitignore() { | |
local IFS=","; | |
if [[ "$#" -eq 0 ]]; then | |
echo "gitignore: try 'gitignore --help' for more information" | |
elif [[ "$1" == "--help" || "$1" == "-h" ]]; then | |
echo "Usage: gitignore [options] <arguments separated by spaces>" | |
echo " -h, --help: show help" | |
echo " -l, --list: list all possible arguments" | |
echo " -s, --save: save the output to a .gitignore file" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class BlurPicassoTransformation implements Transformation { | |
private Context mContext; | |
private int mWidth; | |
private int mHeight; | |
public BlurPicassoTransformation(Context context, int width, int height) { | |
mContext = context; | |
mWidth = width; | |
mHeight = height; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.annotation.TargetApi; | |
import android.content.Context; | |
import android.content.res.Resources; | |
import android.graphics.RectF; | |
import android.os.Build; | |
import android.text.Layout.Alignment; | |
import android.text.StaticLayout; | |
import android.text.TextPaint; | |
import android.util.AttributeSet; | |
import android.util.SparseIntArray; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.content.Context; | |
import android.graphics.Canvas; | |
import android.graphics.Paint; | |
import android.graphics.Rect; | |
import android.util.AttributeSet; | |
import android.widget.ImageView; | |
public class StrokeOverlayImageView extends ImageView { | |
private final int DEFAULT_BORDER_COLOR = 0x26000000; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.content.Context; | |
import android.graphics.Canvas; | |
import android.util.AttributeSet; | |
import android.view.View; | |
public abstract class AbstractView extends View { | |
private float mOffsetX; | |
private float mOffsetY; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.view.View; | |
import android.view.animation.Animation; | |
import android.view.animation.Transformation; | |
public class CollapseAnimation extends Animation implements Animation.AnimationListener { | |
private View mView; | |
private int mInitialHeight; | |
private boolean mAnimating; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copyright 2014 Julian Shen | |
* | |
* 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 |