Skip to content

Instantly share code, notes, and snippets.

@Jpoliachik
Jpoliachik / BottomCrop ImageView
Created December 17, 2013 00:03
Android A subclass of ImageView that scales the image as 'BottomCrop' The source image will be scaled to match the view and cropped so the bottom of the image remains fixed at the bottom of the view. The top will crop according to the view height.
/**
* @author Justin Poliachik
*
* This ImageView subclass allows a scale type of 'BottomCrop'
* The src image will be scaled to match the view and cropped
* so that the bottom of the image remains fixed.
* The top will crop according to the view height.
*/
public class BottomCropImage extends ImageView {
@Jpoliachik
Jpoliachik / TopCropImageAndroid
Last active December 31, 2015 13:59
For Android:A subclass of ImageView that scales the image as 'TopCrop' The source image will be scaled to match the view and cropped so the top of the image remains fixed at the top of the view. The bottom will crop according to the view height.
/**
* @author Justin Poliachik
*
* This ImageView subclass allows a scale type of 'TopCrop'
* The src image will be scaled to match the view and cropped
* so that the top of the image remains fixed.
* The bottom will crop according to the view height.
*/
public class TopCropImage extends ImageView{
@Jpoliachik
Jpoliachik / index.ios.js
Created January 31, 2016 21:07
LayoutAnimation Example No Animation
// Called when a top button is pressed, with index corresponding to button title.
onPress(index) {
this.setState({index: index});
}
@Jpoliachik
Jpoliachik / gist:00b76d1338c700c05274
Created January 31, 2016 21:25
Layout Animation Example Spring
// Called when a top button is pressed, with index corresponding to button title.
onPress(index) {
LayoutAnimation.configureNext(LayoutAnimation.Presets.spring);
this.setState({index: index});
}
@Jpoliachik
Jpoliachik / layoutanimationcustom.js
Last active January 31, 2016 21:40
LayoutAnimation Custom Example
// Spring
var CustomLayoutSpring = {
duration: 400,
create: {
type: LayoutAnimation.Types.spring,
property: LayoutAnimation.Properties.scaleXY,
springDamping: 0.7,
},
update: {
@Jpoliachik
Jpoliachik / android_instructions.md
Created December 13, 2017 20:51 — forked from patrickhammond/android_instructions.md
Easily setup an Android development environment on a Mac

Here is a high level overview for what you need to do to get most of an Android environment setup and maintained.

Prerequisites (for Homebrew at a minimum, lots of other tools need these too):

  • XCode is installed (via the App Store)
  • XCode command line tools are installed (xcode-select --install will prompt up a dialog)
  • Java

Install Homebrew:

ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"

@Jpoliachik
Jpoliachik / RCTAccessibilityManager+FontMultipliers.m
Last active August 28, 2018 13:20
React Native iOS Accessibility Font Scaling Workaround
//
// RCTAccessibilityManager+FontMultipliers.m
//
// This category is a workaround React Native's default Font Sizing Accessibility settings
//
// Swizzle the getter of the font size multipliers so we can limit the max size.
//
#import "RCTAccessibilityManager+FontMultipliers.h"
#import <objc/runtime.h>
@Jpoliachik
Jpoliachik / AppDelegate.m
Created December 19, 2016 15:25
ReactNative iOS Launch Screen No Flash
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// 1. init window
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
UIViewController *rootViewController = [UIViewController new];
// 2. backgroundView using LaunchScreen.xib
UIView *backgroundView = [[[NSBundle mainBundle] loadNibNamed:@"LaunchScreen" owner:self options:nil] firstObject];
backgroundView.frame = self.window.bounds;
@Jpoliachik
Jpoliachik / index.ios.js
Last active August 17, 2021 10:27
ReactNative LayoutAnimation Example
'use strict';
import React, {
AppRegistry,
Component,
StyleSheet,
Text,
View,
TouchableOpacity,
LayoutAnimation,
} from 'react-native';
@Jpoliachik
Jpoliachik / decodeHtml.ts
Created January 9, 2024 15:48
decodeHtml.ts
const entities = {
amp: "&",
apos: "'",
lt: "<",
gt: ">",
quot: '"',
nbsp: "\xa0",
ouml: "ö",
auml: "ä",
uuml: "ü",