Skip to content

Instantly share code, notes, and snippets.

@whileloop99
whileloop99 / gitignore_per_git_branch.md
Created November 12, 2020 12:37 — forked from wizioo/gitignore_per_git_branch.md
HowTo have specific .gitignore for each git branch

How to have specific .gitignore for each git branch

Objective

My objective is to have some production files ignored on specific branches. Git doesn't allow to do it.

Solution

My solution is to make a general .gitignore file and add .gitignore.branch_name files for the branches I want to add specific file exclusion. I'll use post-checkout hook to copy those .gitignore.branch_name in place of .git/info/exclude each time I go to the branch with git checkout branch_name.

@whileloop99
whileloop99 / vue-render-merge.js
Created November 7, 2020 13:33 — forked from manico/vue-render-merge.js
Vue Render Merge
Vue.config.optionMergeStrategies.render = (parentVal, childVal) => {
if (parentVal) {
const mergedParentVal = function render(...args) {
args.push([childVal.apply(this, args)]);
return parentVal.apply(this, args);
};
return mergedParentVal;
}
@whileloop99
whileloop99 / gist:b473489c49ae1d8036a5b438aac80ebf
Created October 11, 2020 14:52 — forked from jfromaniello/gist:4087861
socket-io.client send the cookies!
/*
* Little example of how to use ```socket-io.client``` and ```request``` from node.js
* to authenticate thru http, and send the cookies during the socket.io handshake.
*/
var io = require('socket.io-client');
var request = require('request');
/*
* This is the jar (like a cookie container) we will use always
@whileloop99
whileloop99 / ObservableActivityForResult.java
Created October 3, 2020 15:13 — forked from wispborne/ObservableActivityForResult.java
RxJava wrapper for startActivityForResult and onActivityResult flow. Don't break the chain!
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import com.mywebgrocer.util.ActivityResultData;
import java.util.Random;
@whileloop99
whileloop99 / sample.js
Created September 7, 2020 14:57 — forked from jeffhuangtw/sample.js
[nodejs] server side check "androidpublisher.purchases.subscriptions.get" with "service account"
// Google Play API Key
// ref: http://stackoverflow.com/questions/35127086/android-inapp-purchase-receipt-validation-google-play
// ref: https://developers.google.com/android-publisher/authorization
// ref: http://google.github.io/google-api-nodejs-client/18.0.0/index.html#toc14__anchor
//
// install npm package
// ref: https://github.com/google/google-api-nodejs-client
// $ npm install googleapis --save
//
const google = require('googleapis');
@whileloop99
whileloop99 / chrono-chooser.vue
Created August 29, 2020 09:02 — forked from codenamezjames/chrono-chooser.vue
quasar date range picker
<template>
<div>
<div class="row q-col-gutter-sm q-mb-md q-px-md q-pt-md">
<div class="col flex items-center q-gutter-sm">
<q-input
v-model="zFromUs"
label="From"
outlined
dense
mask="##-##-####"
// Add a 401 response interceptor
window.axios.interceptors.response.use(function (response) {
return response;
}, function (error) {
if (401 === error.response.status) {
swal({
title: "Session Expired",
text: "Your session has expired. Would you like to be redirected to the login page?",
type: "warning",
showCancelButton: true,
@whileloop99
whileloop99 / doze_mode_adb_commands.sh
Last active April 28, 2021 12:40 — forked from y-polek/doze_mode_adb_commands.sh
adb commands to test Doze mode
#! /bin/zsh
#
# https://developer.android.com/training/monitoring-device-state/doze-standby
# https://stackoverflow.com/questions/31533972/how-to-shift-device-in-doze-mode-android-preview-m-marshmallow
# Buttery powered state
adb shell dumpsys battery | grep powered
# Unplug battery
@whileloop99
whileloop99 / dotenv.gradle
Created January 22, 2020 10:34
Gralde DotEnv
import java.util.regex.Matcher
import java.util.regex.Pattern
def getCurrentFlavor() {
Gradle gradle = getGradle()
def pattern = Pattern.compile("(?:.*:)*[a-z]+([A-Z][A-Za-z]+)")
def flavor = ""
gradle.getStartParameter().getTaskNames().any { name ->
Matcher matcher = pattern.matcher(name)
@whileloop99
whileloop99 / AudioRecordActivity.java
Created November 9, 2019 13:26 — forked from kmark/AudioRecordActivity.java
An example of how to read in raw PCM data from Android's AudioRecord API (microphone input, for instance) and output it to a valid WAV file. Tested on API 21/23 on Android and API 23 on Android Wear (modified activity) where AudioRecord is the only available audio recording API. MediaRecorder doesn't work. Compiles against min API 15 and probabl…
/*
* Copyright 2016 Kevin Mark
*
* 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
*
* Unless required by applicable law or agreed to in writing, software