Skip to content

Instantly share code, notes, and snippets.

@kebbbnnn
kebbbnnn / Sample1View.java
Created June 13, 2021 01:43 — forked from winterbe/Sample1View.java
Android custom painting and animations
package de.winterberg.android.sandbox.sample1;
import android.content.Context;
import android.graphics.*;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.LinearInterpolator;
import android.view.animation.RotateAnimation;
/**
@kebbbnnn
kebbbnnn / set_project_profiles.sh
Created January 21, 2021 01:43 — forked from tehnoir/set_project_profiles.sh
Update Xcode project's build settings to point to current provisioning profiles.
#!/bin/bash
##############################################################################################################
### 1. Name your profiles with the convention of ProjectName_TargetName_ConfigurationName.mobileprovision ###
### 2. Create a directory called CodeSign in your project directory ###
### 3. Move all your project's provisioning profiles into the CodeSign directory ###
### ###
### Running this script will update your project file to point to the correct UUIDs of each corresponding ###
### profile in your CodeSign directory. ###
##############################################################################################################
@kebbbnnn
kebbbnnn / BlockBasedSelector.h
Created September 25, 2020 12:48 — forked from cprovatas/BlockBasedSelector.h
Block-Based Selectors in Swift
//
// BlockBasedSelector.h
//
// Created by Charlton Provatas on 11/2/17.
// Copyright © 2017 CharltonProvatas. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface BlockBasedSelector : NSObject
@kebbbnnn
kebbbnnn / DeviceUID.m
Created September 23, 2020 04:15 — forked from miguelcma/DeviceUID.m
iOS Unique Device ID that persists between app reinstalls
/* DeviceUID.h
#import <Foundation/Foundation.h>
@interface DeviceUID : NSObject
+ (NSString *)uid;
@end
*/
// Device.m
@kebbbnnn
kebbbnnn / UIView+isPossiblyVisible.swift
Created August 4, 2020 19:11 — forked from ethanhuang13/UIView+isPossiblyVisible.swift
[WIP] UIView to check is visible on screen. Not perfect solution
extension UIView {
func isPossiblyVisible() -> Bool {
guard isHidden == false,
alpha > 0,
bounds != .zero,
let window = window, // In a window's view hierarchy
window.isKeyWindow, // Does not consider cases covered by another transparent window
window.hitTest(convert(center, to: nil), with: nil) != self
else { return false }
@kebbbnnn
kebbbnnn / yolo.sh
Created May 25, 2020 06:16 — forked from nlutsenko/yolo.sh
Fast Xcode builds
defaults write xcodebuild PBXNumberOfParallelBuildSubtasks 4
defaults write xcodebuild IDEBuildOperationMaxNumberOfConcurrentCompileTasks 4
defaults write com.apple.xcode PBXNumberOfParallelBuildSubtasks 4
defaults write com.apple.xcode IDEBuildOperationMaxNumberOfConcurrentCompileTasks 4
.retryWhen(errors -> errors.flatMap(error -> {
// For IOExceptions, we retry
if (error instanceof RetrofitError) {
RetrofitError retrofitError = (RetrofitError) error;
Response response = retrofitError.getResponse();
if (response.getStatus() == 504) {
return Observable.just(null);
}
}
// For anything else, don't retry
@Override
public void setUserVisibleHint(boolean visible) {
super.setUserVisibleHint(visible);
if (visible && isResumed()) {
// fragment is visible. do some stuff
}
}
@kebbbnnn
kebbbnnn / Node.java
Created September 21, 2017 06:10 — forked from norswap/Node.java
Fast Java Reflection
package demo;
public interface Node {}
DisplayMetrics displayMetrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
int height = displayMetrics.heightPixels;
int height75Percent = height - (height * 0.75f);