Skip to content

Instantly share code, notes, and snippets.

@mikeseif
mikeseif / DesaturateInterpolator
Last active August 29, 2015 14:06
Desaturate the given Color int by the ratio provided, 1.0f for full saturation, 0.0f for max desaturation. Edit the minimum value of 0.2f (or add as an additional param) to alter how low the desaturation can go.
/**
* Desaturate the given color int value by the provided ratio, down to a minimum of 0.2f.
*
* Note: Do not pass R.color ints, resolve the actual color int via
* getResources().getColor(R.color.your_color_name_here).
*
* f(x) = ( startSaturation / 1.0f * ratio ) + ( minSaturation * (1.0f - ratio) )
*
* @param int The color value to desaturate
* @param float The ratio to desatrate by (0.0f - 1.0f)
@nguyenhuy
nguyenhuy / Activity.java
Last active January 2, 2016 16:49
Show a badge on top of an ABS's MenuItem, using BadgeView from https://github.com/jgilfelt/android-viewbadger.
private BadgeView mBadgeView;
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getSupportMenuInflater().inflate(R.menu.badge_demo, menu);
MenuItem menuItem = menu.findItem(R.id.item_id);
ImageButton iconView = new ImageButton(this, null,
com.actionbarsherlock.R.style.Widget_Sherlock_ActionButton);
iconView.setImageDrawable(menuItem.getIcon());
@kdonald
kdonald / CorisFilter.java
Created March 29, 2012 01:12
Basic Cross Origin Resource Sharing (CORS) support
package org.springframework.web.servlet.support;
import java.io.IOException;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.filter.OncePerRequestFilter;
@JakeWharton
JakeWharton / README.md
Last active January 8, 2020 02:13
A special activity which facilitates restarting your application process.
@donnfelker
donnfelker / CircularTransformation.java
Last active December 2, 2020 20:47
Picasso and CircularTransform Example
import android.graphics.*;
import com.squareup.picasso.Transformation;
/**
* Transforms an image into a circle representation. Such as a avatar.
*/
public class CircularTransformation implements Transformation
{
int radius = 10;
@xaviervia
xaviervia / README.md
Last active February 16, 2021 20:12
Sketch 43 files JSON types
@philfreo
philfreo / _README.md
Last active February 3, 2022 20:46
How to do conditional statements in Close.io template tags
# 10_basic.py
# 15_make_soup.py
# 20_search.py
# 25_navigation.py
# 30_edit.py
# 40_encoding.py
# 50_parse_only_part.py
@jareware
jareware / SCSS.md
Last active April 23, 2024 22:13
Advanced SCSS, or, 16 cool things you may not have known your stylesheets could do

⇐ back to the gist-blog at jrw.fi

Advanced SCSS

Or, 16 cool things you may not have known your stylesheets could do. I'd rather have kept it to a nice round number like 10, but they just kept coming. Sorry.

I've been using SCSS/SASS for most of my styling work since 2009, and I'm a huge fan of Compass (by the great @chriseppstein). It really helped many of us through the darkest cross-browser crap. Even though browsers are increasingly playing nice with CSS, another problem has become very topical: managing the complexity in stylesheets as our in-browser apps get larger and larger. SCSS is an indispensable tool for dealing with this.

This isn't an introduction to the language by a long shot; many things probably won't make sense unless you have some SCSS under your belt already. That said, if you're not yet comfy with the basics, check out the aweso

@paulirish
paulirish / bling.js
Last active May 1, 2024 19:56
bling dot js
/* bling.js */
window.$ = document.querySelectorAll.bind(document);
Node.prototype.on = window.on = function (name, fn) {
this.addEventListener(name, fn);
}
NodeList.prototype.__proto__ = Array.prototype;