Skip to content

Instantly share code, notes, and snippets.

@kumbasar
kumbasar / jenkins_delete_builds.groovy
Last active June 10, 2021 17:07 — forked from pkouman/jenkins_delete_builds.groovy
Jenkins - Delete old builds script
MAX_BUILDS = 10 // max builds to keep
def jobs = Jenkins.instance.items;
for (job in jobs) {
println "Job: " + job.name
try {
if(job instanceof jenkins.branch.MultiBranchProject) {
println "Multibranch"
job = job.getJob("master")
android {
lintOptions {
// Severity Overrides
warning (
// These are errors by default
"OnClick",
"MissingPermission",
"MissingSuperCall",
"GradleCompatible",
"GradlePluginVersion",
@ju1
ju1 / zopimGTMRecipe
Created June 24, 2017 20:06
Zopim Tracking Recipe for Google Tag Manager
{
"exportFormatVersion": 2,
"exportTime": "2017-06-24 20:06:17",
"containerVersion": {
"path": "accounts/1164259306/containers/7113206/versions/0",
"accountId": "1164259306",
"containerId": "7113206",
"containerVersionId": "0",
"container": {
"path": "accounts/1164259306/containers/7113206",
package com.alexzh.recyclerviewsetemptyview;
import android.content.Context;
import android.support.annotation.Nullable;
import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;
import android.view.View;
public class EmptyRecyclerView extends RecyclerView {
private View mEmptyView;
@andymatuschak
andymatuschak / States-v3.md
Last active October 14, 2025 19:24
A composable pattern for pure state machines with effects (draft v3)

A composable pattern for pure state machines with effects

State machines are everywhere in interactive systems, but they're rarely defined clearly and explicitly. Given some big blob of code including implicit state machines, which transitions are possible and under what conditions? What effects take place on what transitions?

There are existing design patterns for state machines, but all the patterns I've seen complect side effects with the structure of the state machine itself. Instances of these patterns are difficult to test without mocking, and they end up with more dependencies. Worse, the classic patterns compose poorly: hierarchical state machines are typically not straightforward extensions. The functional programming world has solutions, but they don't transpose neatly enough to be broadly usable in mainstream languages.

Here I present a composable pattern for pure state machiness with effects,

@alexsorokoletov
alexsorokoletov / CIEditorScript.cs
Created November 20, 2015 10:50
Unity3d automation script for Android and iOS
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
public class CIEditorScript
{
static string[] SCENES = FindEnabledEditorScenes ();
@qinshulei
qinshulei / ConvertAndroidVectorDrawable2png.md
Last active June 9, 2025 17:00
Convert Android VectorDrawable to png

转换方法:

  1. Convert Android VectorDrawable to SVG:

使用附件中的java程序。命令如下:

cp Vector2Svg.java path/to/xml_dir
javac Vector2Svg.java
java Vector2Svg ./*.xml
mkdir svg_dir
@ftvs
ftvs / PhonecallReceiver.java
Last active October 26, 2025 18:51
Detecting an incoming call coming to an Android device. Remember to set the appropriate permissions in AndroidManifest.xml as suggested in the Stackoverflow link. Usage example in comments. Source: Gabe Sechan http://stackoverflow.com/a/15564021/264619 Explanation: http://gabesechansoftware.com/is-the-phone-ringing/#more-8
package com.gabesechan.android.reusable.receivers;
import java.util.Date;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.telephony.TelephonyManager;
public abstract class PhonecallReceiver extends BroadcastReceiver {
@gabrielemariotti
gabrielemariotti / README.md
Last active February 24, 2021 10:52
How to manage the support libraries in a multi-module projects. Thanks to Fernando Cejas (http://fernandocejas.com/)

Centralize the support libraries dependencies in gradle

Working with multi-modules project, it is very useful to centralize the dependencies, especially the support libraries.

A very good way is to separate gradle build files, defining something like:

root
  --gradleScript
 ----dependencies.gradle
@elevenetc
elevenetc / gist:bf795f94aaf3e92169ef
Last active February 4, 2025 17:57
Android SuppressWarnings list
//src: http://kurrytran.blogspot.ru/2014/05/android-studio-list-of-suppress-warning.html
//https://android.googlesource.com/platform/tools/adt/idea/+/jb-mr2-dev/adt-branding/src/META-INF/AndroidIdePlugin.xml
//https://android.googlesource.com/platform/tools/adt/idea/+/jb-mr2-dev/android/src/META-INF/plugin.xml
//Most Common Annotations
@SuppressWarnings("all")
@SuppressWarnings("unchecked")
@SuppressWarnings({"JavaDoc"})
@SuppressWarnings({"UnusedDeclaration"})