Skip to content

Instantly share code, notes, and snippets.

View alexandrius's full-sized avatar

Alexander Pataridze alexandrius

View GitHub Profile
@alexandrius
alexandrius / fetch.js
Created June 17, 2023 21:23
use-fetch-hook
import { baseUrl } from 'env';
function handleResponse(response) {
return response.text().then((text) => {
const data = text && JSON.parse(text);
if (!response.ok) {
const error = (data && data.error) || response.statusText;
return Promise.reject(error);
}
@alexandrius
alexandrius / switchpro.js
Created December 6, 2022 13:36
Updated react native switch pro
import React, { Component } from 'react';
import { StyleSheet, Animated, Easing, PanResponder } from 'react-native';
const SCALE = 6 / 5;
export default class extends Component {
static defaultProps = {
width: 40,
height: 21,
value: false,
import PropTypes from 'prop-types';
import React, { Component } from 'react';
import {
ViewPropTypes,
ColorPropType,
StyleSheet,
Animated,
Easing,
PanResponder,
} from 'react-native';
package ge.bog.mobilebank.ui.views.widgets;
/**
* Created by alex on 2/21/17.
*/
import android.content.Context;
import android.support.v7.widget.AppCompatEditText;
import android.text.Editable;
import android.text.InputFilter;
public class CircleProgressView extends View {
private static final int START_ANGLE_POINT = 270;
private Paint paint;
private RectF rect;
private float angle;
private RectF shadowRect;
private Paint shadowPaint;
private Paint circlePaint;
package ge.bog.cbtransactions.utils;
import android.annotation.TargetApi;
import android.app.Activity;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.os.Build;
@alexandrius
alexandrius / gist:5e17925c809bc1eb2119
Created February 6, 2015 11:55
Blur UIImage iOS Swift
func imageWithGaussianBlur(image: UIImage) -> UIImage{
var weight:[CGFloat] = [0.1870270270, 0.2345945946, 0.1816216216, 0.0940540541, 0.0762162162, 0.0940540541, 0.16162162162, 0.1962162162, 0.2040540541, 0.0662162162]
UIGraphicsBeginImageContextWithOptions(image.size, Bool(false), image.scale)
image.drawInRect(CGRectMake(0, 0, image.size.width, image.size.height), blendMode: kCGBlendModeNormal, alpha: weight[0])
var blurCount = Int(blurAmount)
if(blurCount > 9){
blurCount = 9
}
func fixOrientation (image: UIImage) -> UIImage {
if (image.imageOrientation == UIImageOrientation.Up){
return image
}
var transform = CGAffineTransformIdentity;
switch (image.imageOrientation) {
case UIImageOrientation.Down, UIImageOrientation.DownMirrored:
transform = CGAffineTransformTranslate(transform, image.size.width, image.size.height);