Skip to content

Instantly share code, notes, and snippets.

@olivierperez
olivierperez / combinations.js
Last active March 28, 2020 12:25
JS Combinations
const computeCombinations = (items) => {
let doIt = (rest, start, output) => {
if (rest.length == 0) {
output.push(start)
return
}
for (let i=0; i < rest.length; i++) {
let begin = rest.slice(0, i)
let end = rest.slice(i+1)
@olivierperez
olivierperez / CallStack.kt
Created January 9, 2020 14:26
Debug - CallStack
fun buildCallStack(): String {
return Exception().stackTrace
.asSequence()
.filter {
!it.className.startsWith("fr.o80.corelib") &&
!it.className.startsWith("io.reactivex") &&
"rxext" !in it.fileName.toLowerCase(Locale.FRENCH)&&
"MyDebuggerClass" !in it.className
}
.take(4)
#!/bin/bash
GREEN='\033[0;32m'
BROWN='\033[0;33m'
DARK_GRAY='\033[1;30m'
NC='\033[0m' # No Color
IFS=$'\n'
for folder in `find . -maxdepth 1 -type d ! -name .idea* ! -name gitall ! -path . | sort`
do
Useful tricks for Android gradle files
- build time
- ci_job
- dependencies
- force a lang for a specific flavor
- gcm flavorish google-services.json
- git commit count
- git sha
- isIdeBuild
TextViewAnimator animator = new TextViewAnimator();
animator.flip(myTextView, label);
// animator.fade(myTextView, label);
@olivierperez
olivierperez / Gradle tasks & scripts
Last active August 10, 2016 10:01
Gradle tasks & scripts
The Gradle tasks & scripts I need everywhere.
- ci_job
- GCM with flavor
@olivierperez
olivierperez / CSGO.cfg
Last active December 9, 2017 12:17
CSGO config
All my CSGO config files.
- aim_map
- autoexec
- nades
- training
Live Templates for AndroidStudio
- test - Create a new test
# Copyright (C) 2015 Olivier Perez <olivier@olivierperez.fr>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
@olivierperez
olivierperez / drawable-debug_outline.xml
Last active February 22, 2016 15:49
Android - Draw outline of views on old Android, when the developer tools don't display outline of views.
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<stroke
android:width="2dp"
android:color="@android:color/holo_blue_dark"/>
</shape>
</item>
@olivierperez
olivierperez / git-last
Last active December 18, 2015 14:33
Git - Script that return the last changes
#!/bin/bash
# git-last - Return the last changes (last commit, staged changes, current changes)
# Copyright (C) 2015 Olivier Perez <olivier@olivierperez.fr>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,