Skip to content

Instantly share code, notes, and snippets.

@brentjanderson
brentjanderson / Controller.php
Created July 11, 2012 19:54
Yii Framework cache busting with Git and some magic page post-processing.
public function processOutput($output) {
$output = parent::processOutput($output);
$output = str_replace('.css', '.css?' . Yii::app()->params['git-hash'], $output);
$output = str_replace('.js', '.js?' . Yii::app()->params['git-hash'], $output);
return $output;
}
@marcelpinto
marcelpinto / ControllableAppBarLayout.java
Last active December 12, 2019 03:42 — forked from blipinsk/ControllableAppBarLayout.java
An extension of Android AppBarLayout, that allows to programatically change the CollapsibleToolbarLayout state and receive state changes (collapsed, expanded and idle)
package com.eatfirst.android.ui.custom;
/**
* Copyright 2015 Bartosz Lipinski
*
* 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
@andreynovikov
andreynovikov / OnItemSelectedListener.java
Last active June 14, 2020 17:43
Complete working solution for Android action bar tabs with fragments having separate back stack for each tab.
// Custom interface that enables communication between Fragment and its Activity
public interface OnItemSelectedListener
{
public void onItemSelected(String item);
}
@davemorrissey
davemorrissey / PicassoDecoder.java
Last active November 26, 2021 14:17 — forked from gokhanbarisaker/PicassoDecoder.java
Picasso decoder for subsampling-scale-image-view
/**
* Created by gokhanbarisaker on 8/30/15.
*/
public class PicassoDecoder implements ImageDecoder
{
private String tag;
private String picasso;
public PicassoDecoder(String tag, Picasso picasso) {
this.tag = tag;
@sethbergman
sethbergman / install-docker.sh
Last active December 27, 2021 16:38 — forked from dweldon/install-docker.sh
Install Docker CE on Linux Mint 19
#!/usr/bin/env bash
set -e
# https://docs.docker.com/engine/install/ubuntu/
sudo apt-get -y install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - 2>/dev/null
sudo echo "deb [arch=amd64] https://download.docker.com/linux/$(lsb_release -is | tr '[:upper:]' '[:lower:]') bionic stable" > /etc/apt/sources.list.d/docker.list
sudo apt-get -y update
@zokipirlo
zokipirlo / DividerItemDecoration.java
Last active June 23, 2022 14:59 — forked from lapastillaroja/DividerItemDecoration.java
DividerItemDecoration. RecyclerView.ItemDecoration simple implementation
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;
import android.view.View;
@meoyawn
meoyawn / EmptyRecyclerView.java
Created November 1, 2014 11:20
RecyclerView doesn't have an emptyView support, we gotta fix that
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;
import android.view.View;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class EmptyRecyclerView extends RecyclerView {
@Nullable View emptyView;
@jsmouret
jsmouret / struct.go
Last active November 1, 2022 10:06
Convert map[string]interface{} to a google.protobuf.Struct
package pb
import (
"fmt"
"reflect"
st "github.com/golang/protobuf/ptypes/struct"
)
// ToStruct converts a map[string]interface{} to a ptypes.Struct
@groovybayo
groovybayo / step-by-step-gatling-idea.md
Last active November 7, 2022 06:47
Gatling: Step by step guide to IntelliJ integration

Step by step guide to setting up IDEA to write gatling simulations

Prerequisites:

Have [SBT plugin][sbt-plugin] installed

Begin

  • [Create a new project][create-project] in IDEA ( File > New Project ...)
    • Make sure you select a maven module
@kendru
kendru / golang-to-node-authenticated-encryption.js
Last active October 24, 2023 13:15
Decrypting AES-256-GCM encoded in Go from Node
// Usage: go run main.go | node decode.js
/*
// main.go:
package main
import (
"crypto/aes"
"crypto/cipher"