Skip to content

Instantly share code, notes, and snippets.

View AlexKorovyansky's full-sized avatar

Alex Korovyansky AlexKorovyansky

View GitHub Profile
@AlexKorovyansky
AlexKorovyansky / Git-Config-Teamplate
Last active August 29, 2015 13:56
Template for .gitconfig
[user]
name = Alex Korovyansky
email = korovyansk@gmail.com
[core]
excludesfile = /Users/akorovyansky/.gitignore_global
editor = subl -n -w
[push]
default = simple
@AlexKorovyansky
AlexKorovyansky / 0_reuse_code.js
Created July 22, 2014 05:54
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@AlexKorovyansky
AlexKorovyansky / .gitconfig
Created August 1, 2014 05:40
Template for .gitconfig
[user]
name = Alex Korovyansky
email = korovyansk@gmail.com
[core]
editor = subl -n -w
[push]
default = simple
@AlexKorovyansky
AlexKorovyansky / ViewMatchers.java
Last active January 16, 2017 09:59
Espresso ViewMatchers -> withDrawable
public static Matcher<View> withDrawable(final int resourceId) {
return new TypeSafeMatcher<View>() {
@Override
public void describeTo(Description description) {
description.appendText("with drawable from resource id: " + resourceId);
}
@Override
public boolean matchesSafely(View view) {
try {
@AlexKorovyansky
AlexKorovyansky / WeatherResponse.java
Last active August 29, 2015 14:06
Weather Response
// http://api.openweathermap.org/data/2.5/forecast/daily?q=Moscow&mode=json&units=metric&cnt=2&lang=ru
public class Response {
public static class Forecast {
public static class Temp {
@SerializedName("day")
public final double day;
@SerializedName("night")
@AlexKorovyansky
AlexKorovyansky / cgacac.sh
Last active August 29, 2015 14:07
Change Git Author/Commiter in all commits
# thanks to http://stackoverflow.com/questions/4981126/how-to-amend-several-commits-in-git
git filter-branch --env-filter 'if [ "$GIT_AUTHOR_EMAIL" = "incorrect@email" ]; then
GIT_AUTHOR_EMAIL=correct@email;
GIT_AUTHOR_NAME="Correct Name";
GIT_COMMITTER_EMAIL=$GIT_AUTHOR_EMAIL;
GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"; fi' -- --all
@AlexKorovyansky
AlexKorovyansky / HockNewRelicProperties.groovy
Created October 15, 2014 07:12
Hook newrelic.properties for auto switch between debug and release builds.
android.applicationVariants.all { variant ->
task ("prepareNewRelicProperties${variant.name.capitalize()}"){
doLast {
copy {
from variant.buildType.debuggable ? "${project.projectDir}/src/debug/newrelic.properties" : "${project.projectDir}/src/release/newrelic.properties"
into "${project.projectDir}"
}
}
}
tasks.getByName("prepare${variant.name.capitalize()}Dependencies").dependsOn("prepareNewRelicProperties${variant.name.capitalize()}")
@AlexKorovyansky
AlexKorovyansky / NewRelicSplitApplication.java
Last active March 9, 2021 15:54
Trick for separating Develop from Release versions in New Relic Mobile SDK.
...
NewRelic.withApplicationToken(getString(R.string.my_new_relic_application_token).start(this);
...
@AlexKorovyansky
AlexKorovyansky / git-cheatsheet.sh
Last active August 29, 2015 14:07
Git CheatSheet
Rename branch:
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
// To be continued
@AlexKorovyansky
AlexKorovyansky / Main.js
Last active August 29, 2015 14:07
GAS Stuff for transformation Google Form response to Mailchimp subscriber
String.prototype.startsWith=function(str){return this.indexOf(str) == 0;}
String.prototype.trim=function(){return this.replace(/^\s\s*/, '').replace(/\s\s*$/, '');};
var tag = "devfest14_registration";
var spreadSheet = SpreadsheetApp.getActiveSpreadsheet();
var metaSheetResponses = makeMetaSheet(spreadSheet.getSheetByName("Responses"), 2, 0);
var metaRowFlatRange = metaSheetResponses.getMetaRowFlatRange(1);
var emailPositionInDataRange = metaRowFlatRange.positionOf("EMAIL^");
var invitationCodePositionInRange = metaRowFlatRange.positionOf("MERGE_INVCODE^");
var invitationCodeStatusPositionInRange = metaRowFlatRange.positionOf("MERGE_INVSTAT");
var responseStatusPositionInRange = metaRowFlatRange.positionOf(":STATUS");