Skip to content

Instantly share code, notes, and snippets.

View afshin-hoseini's full-sized avatar
🎯
Focusing

Afshin Hoseini afshin-hoseini

🎯
Focusing
View GitHub Profile
@afshin-hoseini
afshin-hoseini / Swizzeling main bundle.swift
Created November 20, 2017 07:12
Forcing change localization for first iOS application run
//First, define a custom bundle class as like as below
import Foundation
//A key used for exchanging associated object
var _BUNDLE_KEY = 0
class BundleEx : Bundle {
override func localizedString(forKey key: String, value: String?, table tableName: String?) -> String {
@afshin-hoseini
afshin-hoseini / braking.md
Created February 14, 2022 20:28 — forked from andrebq/braking.md
Fahrschule

Braking

Standard Braking Distance

  • DE: (Geschwindigkeit / 10) * (Geschwindigkeit / 10)
  • EN: (Speed / 10) * (Speed / 10)

Evasive (Emergency) Braking Distance

  • DE: ((Geschwindigkeit / 10) * (Geschwindigkeit / 10)) / 2
  • EN: ((Speed / 10) * (Speed / 10)) / 2
@afshin-hoseini
afshin-hoseini / SerializedAsyncTasks.js
Created July 10, 2021 15:57
How to serialize asynchronous calls to an async function in javascript
/*
*/
function serialized(fn){
let queue = Promise.resolve();
return (...args)=>{
const res = queue.then(() => fn(...args));
queue = res.catch(() => {});
return res;
@afshin-hoseini
afshin-hoseini / index.html
Created September 4, 2020 17:30
Sticky (gooey) effect using CSS SVG Filters
<div class="bubbles-wrapper bubbles-circle">
<div class="bubble">1</div>
<div class="bubble">2</div>
<div class="bubble">3</div>
<div class="bubble">4</div>
<div class="bubble">5</div>
<div class="bubble">6</div>
</div><!-- remove spaces
--><div class="bubbles-wrapper bubbles-vertical">
<div class="bubble"></div>
@afshin-hoseini
afshin-hoseini / CustomBlurView.swift
Created February 13, 2016 06:07
Custom blur view which you can determine blur radius for
//
// APCustomBlurView.swift
// Created by Collin Hundley on 1/15/16.
//
import UIKit
public class APCustomBlurView: UIVisualEffectView {
private let blurEffect: UIBlurEffect
@afshin-hoseini
afshin-hoseini / FlingBehavior
Created October 9, 2016 20:12
Fling behavior for appbar and recyclerview
package ir.abrishamapp.abrishamandroidapp.Activities.OrdersLayer.DetailsViewer;
import android.content.Context;
import android.support.design.widget.AppBarLayout;
import android.support.design.widget.CoordinatorLayout;
import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;
@afshin-hoseini
afshin-hoseini / SegmentedControlTab.js
Created December 28, 2018 10:00
React native segmented tabbar + render custom items
import React, { Component } from 'react';
import {
View,
ViewPropTypes,
TouchableOpacity,
StyleSheet,
Text
} from 'react-native';
import PropTypes from 'prop-types';
@afshin-hoseini
afshin-hoseini / react-native-paper.d.ts
Last active December 21, 2018 20:03 — forked from doomsower/react-native-paper.d.ts
react-native-paper.d.ts
// tslint:disable:max-classes-per-file
declare module 'react-native-paper' {
import { Component, ReactNode } from 'react';
import {
StyleProp,
TextProps,
TextStyle,
TouchableHighlightProps,
TouchableNativeFeedbackProps,
ViewProps,
@afshin-hoseini
afshin-hoseini / FMDB pof file
Created November 21, 2017 17:31
FMDB pof file config for swift 3
pod 'FMDB'#, :git => 'https://github.com/ccgus/fmdb.git', :commit => '1b346b527179f8869d6e8332917c80ac83337ee8'
post_install do |installer|
Dir['Pods/*/**/*.h'].each { |file|
search_text = %q["sqlite3.h"]
replace_text = '<SQLCipher/sqlite3.h>'
oldFile = File.read(file)
if oldFile.include? search_text
@afshin-hoseini
afshin-hoseini / KeyboardBehaviorController.swift
Created June 20, 2017 06:56
Swift keyboard frame change behavior controller
//
// KeyboardBehaviorController.swift
// Spot
//
// Created by Afshin on 6/20/17.
// Copyright © 2017 AFE. All rights reserved.
//
import Foundation
import UIKit