Skip to content

Instantly share code, notes, and snippets.

@joechrysler
joechrysler / who_is_my_mummy.sh
Last active May 14, 2024 12:26
Find the nearest parent branch of the current git branch
#!/usr/bin/env zsh
git show-branch -a \
| grep '\*' \
| grep -v `git rev-parse --abbrev-ref HEAD` \
| head -n1 \
| sed 's/.*\[\(.*\)\].*/\1/' \
| sed 's/[\^~].*//'
# How it works:
@aras-p
aras-p / preprocessor_fun.h
Last active November 15, 2024 09:22
Things to commit just before leaving your job
// Just before switching jobs:
// Add one of these.
// Preferably into the same commit where you do a large merge.
//
// This started as a tweet with a joke of "C++ pro-tip: #define private public",
// and then it quickly escalated into more and more evil suggestions.
// I've tried to capture interesting suggestions here.
//
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_,
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant,
@broady
broady / 1MarkerAnimation.java
Last active August 19, 2024 12:30
Animating Markers
/* Copyright 2013 Google Inc.
Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0.html */
package com.example.latlnginterpolation;
import android.animation.ObjectAnimator;
import android.animation.TypeEvaluator;
import android.animation.ValueAnimator;
import android.annotation.TargetApi;
import android.os.Build;
@frankyonnetti
frankyonnetti / CSS--hex-opacity-values.css
Last active August 1, 2024 16:33
#css Hex Opacity Values
/*
* Hex Opacity Values
*/
100% — FF
95% — F2
90% — E6
85% — D9
80% — CC
75% — BF
@akshaydashrath
akshaydashrath / ToggleImageButton
Created March 20, 2014 11:49
A ToggleImageButton for Android
import android.content.Context;
import android.content.res.TypedArray;
import android.os.Bundle;
import android.os.Parcelable;
import android.util.AttributeSet;
import android.view.View;
import android.widget.Checkable;
import android.widget.ImageButton;
public class ToggleImageButton extends ImageButton implements Checkable {
@eyecatchup
eyecatchup / 0_localcast.md
Last active October 19, 2022 12:21
How-To cast any mp4 file from Android to Chromecast.

Cast any (local & remote) mp4 file from Chrome for Android to Chromecast


> If you prefer a _magazine-style_ formatting to read [this gist](https://gist.github.com/eyecatchup/10706409), [click here](http://gist.io/10706409).
A few days ago (April 10th 2014) I was very surprised when I've read on Engadget.com the headline [*"Chrome beta for Android makes it easy to send web video to Chromecast"*](http://j.mp/1gzphu7).

The post attached to this headline refered to a blog post by the Chrome Release team, which was published the same day - April 10th 2014 - and announced the beta release of Chrome 35 for Android. And, indeed, as one of the new features the Chrome team listed

import android.content.Context;
import android.content.res.TypedArray;
import android.os.Bundle;
import android.os.Parcelable;
import android.util.AttributeSet;
import android.view.View;
import android.widget.Checkable;
import android.widget.ImageButton;
public class ToggleImageButton extends ImageButton implements Checkable {
@philipbulley
philipbulley / Controller.ts
Last active March 20, 2023 19:59
Bind all TypeScript class methods to class scope. You get the benefits of fat arrow/lambda functions (`=>`) with the major bonus of inheritance.
/**
* Example of usage in an abstract controller
*/
module base
{
export class Controller
{
constructor()
{
FunctionUtil.bindAllMethods( this );
var mediaJSON = { "categories" : [ { "name" : "Movies",
"videos" : [
{ "description" : "Big Buck Bunny tells the story of a giant rabbit with a heart bigger than himself. When one sunny day three rodents rudely harass him, something snaps... and the rabbit ain't no bunny anymore! In the typical cartoon tradition he prepares the nasty rodents a comical revenge.\n\nLicensed under the Creative Commons Attribution license\nhttp://www.bigbuckbunny.org",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" ],
"subtitle" : "By Blender Foundation",
"thumb" : "images/BigBuckBunny.jpg",
"title" : "Big Buck Bunny"
},
{ "description" : "The first Blender Open Movie from 2006",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4" ],
@mpost
mpost / colors.xml
Last active September 4, 2024 05:58
This gist demonstrates how to create an animated pause/resume media playback button for Android. It uses animated vector drawables and state transitions to orchestrate the effect. Some background: https://plus.google.com/u/0/+MoritzPost/posts/3EFF8uC7jXv
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="action_pause">#FF8F00</color>
<color name="action_resume">#43A047</color>
</resources>