Skip to content

Instantly share code, notes, and snippets.

View ok3141's full-sized avatar

Oleksii ok3141

View GitHub Profile

###styles.xml

<style name="Theme.Custom.Dark" parent="@android:style/Theme.Holo.Light.DarkActionBar">
    <!-- -->
    <item name="android:windowAnimationStyle">@style/Custom.Window.Animation</item>
</style>

<style name="Custom.Window.Animation" parent="@android:style/Animation.Activity">
    <item name="android:activityOpenEnterAnimation">@anim/custom_in_next</item>
 @anim/custom_out_curr
package android.support.v4.preference;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
@ok3141
ok3141 / Perlin_Tiled.cs
Created June 7, 2016 06:21 — forked from Flafla2/Perlin_Tiled.cs
A slightly modified implementation of Ken Perlin's improved noise that allows for tiling the noise arbitrarily.
public class Perlin {
public int repeat;
public Perlin(int repeat = -1) {
this.repeat = repeat;
}
public double OctavePerlin(double x, double y, double z, int octaves, double persistence) {
double total = 0;
@ok3141
ok3141 / DividerItemDecoration.java
Created June 22, 2016 10:30 — forked from alexfu/DividerItemDecoration.java
An ItemDecoration that draws dividers between items. Pulled from Android support demos.
/*
* Copyright (C) 2014 The Android Open Source Project
*
* 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
@ok3141
ok3141 / SavWav.cs
Created August 28, 2016 12:36 — forked from darktable/SavWav.cs
Unity3D: script to save an AudioClip as a .wav file.
// Copyright (c) 2012 Calvin Rien
// http://the.darktable.com
//
// This software is provided 'as-is', without any express or implied warranty. In
// no event will the authors be held liable for any damages arising from the use
// of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
@ok3141
ok3141 / gist:4e9646efea38b434273196ded6a91c1a
Created October 10, 2016 09:58 — forked from sgergely/gist:3793166
Midnight Commander Keyboard Shortcuts for Mac OSX
----- Esc -----
Quick change directory: Esc + c
Quick change directory history: Esc + c and then Esc + h
Quick change directory previous entry: Esc + c and then Esc + p
Command line history: Esc + h
Command line previous command: Esc + p
View change: Esc + t (each time you do this shortcut a new directory view will appear)
Print current working directory in command line: Esc + a
Switch between background command line and MC: Ctrl + o
Search/Go to directory in active panel: Esc + s / Ctrl + s then start typing directory name
@ok3141
ok3141 / Android_enableManifestComponent.java
Created November 14, 2017 10:04 — forked from sdecima/Android_enableManifestComponent.java
How to dynamically enable/disable an Android Component declared in the manifest.
import android.content.ComponentName;
import android.content.Context;
import android.content.pm.PackageManager;
public class Android_enableManifestComponent {
public static void enableManifestComponent(Context context, Class<?> component, boolean enable) {
ComponentName receiver = new ComponentName(context, component);
PackageManager pm = context.getPackageManager();
@ok3141
ok3141 / dagger-android-view.md
Created April 10, 2018 09:35 — forked from ronshapiro/dagger-android-view.md
dagger.android for views in ~10 minutes

1. You can implement View.getActivity() like this:

public interface ViewWithActivity {
  // Using android-gradle-plugin 3.0, which has the desugar step for default methods on interfaces
  default Activity getActivity() {
    // https://android.googlesource.com/platform/frameworks/support/+/03e0f3daf3c97ee95cd78b2f07bc9c1be05d43db/v7/mediarouter/src/android/support/v7/app/MediaRouteButton.java#276
    Context context = getContext();
    while (context instanceof ContextWrapper) {
      if (context instanceof Activity) {
@ok3141
ok3141 / build.gradle
Created May 9, 2018 12:16 — forked from michail-nikolaev/build.gradle
Gradle - force transitive dependency version for some group
apply plugin: 'java'
configurations.all {
resolutionStrategy {
eachDependency { DependencyResolveDetails details ->
//specifying a fixed version for all libraries with 'org.gradle' group
if (details.requested.group == 'org.springframework') {
details.useVersion "$springVersion"
}
}
@ok3141
ok3141 / build.gradle
Created August 3, 2018 12:05 — forked from lifuzu/build.gradle
Parse XML file in gradle
//Declaring the inputs and outputs of a task
//build.gradle
task transform {
ext.srcFile = file('mountains.xml')
ext.destDir = new File(buildDir, 'generated')
inputs.file srcFile
outputs.dir destDir
doLast {
println "Transforming source file."