Skip to content

Instantly share code, notes, and snippets.

View rizwan95's full-sized avatar
🎯
Focusing

Rizwan Ahmed rizwan95

🎯
Focusing
View GitHub Profile
@rizwan95
rizwan95 / LanguageCodes.json
Created March 20, 2021 17:21
ISO 639-1 Language codes
{
"af_NA":"Afrikaans (Namibia)",
"af_ZA":"Afrikaans (South Africa)",
"af":"Afrikaans",
"ak_GH":"Akan (Ghana)",
"ak":"Akan",
"sq_AL":"Albanian (Albania)",
"sq":"Albanian",
"am_ET":"Amharic (Ethiopia)",
"am":"Amharic",
@rizwan95
rizwan95 / MultilineTextView.swift
Created August 1, 2020 10:38
Multiline Text View implementation in SwiftUI
import SwiftUI
struct MultiLineTextView: View {
var attributedString: NSAttributedString
var body: some View {
GeometryReader { geometry in
MyTextView(width: geometry.size.width, attributedString: self.attributedString)
}
}
}
struct AttachmentsModel : Hashable{
let identifier = UUID()
let image: UIImage
func hash(into hasher: inout Hasher) {
hasher.combine(identifier)
}
static func getModel() -> [AttachmentsModel]{
return [AttachmentsModel(image: UIImage(named: "simage1")!),AttachmentsModel(image: UIImage(named: "simage2")!),AttachmentsModel(image: UIImage(named: "simage1")!),AttachmentsModel(image: UIImage(named: "simage1")!),AttachmentsModel(image: UIImage(named: "simage1")!)]

Keybase proof

I hereby claim:

  • I am rizwan95 on github.
  • I am rizwan95 (https://keybase.io/rizwan95) on keybase.
  • I have a public key ASDrxdT50IurA20mz9DBOWBTd5o35r1FQdMzEc5hWVzGLAo

To claim this, I am signing this object:

@rizwan95
rizwan95 / inspect.swift
Created October 21, 2018 07:14 — forked from tjeerdintveen/inspect.swift
inspect as an extension on Sequence
extension Sequence {
public func inspect(
_ body: (Element) throws -> Void
) rethrows -> Self {
for element in self {
try body(element)
}
return self
}
}
@rizwan95
rizwan95 / gist:c58e6a4cd3316cc5271cad8a1c9fed61
Created April 5, 2018 08:39
Method swizzling for element.focus() in WKWebView
#import <objc/runtime.h>
@implementation WebViewInjection
+ (void)allowDisplayingKeyboardWithoutUserAction {
Class class = NSClassFromString(@"WKContentView");
NSOperatingSystemVersion iOS_11_3_0 = (NSOperatingSystemVersion){11, 3, 0};
if ([[NSProcessInfo processInfo] isOperatingSystemAtLeastVersion: iOS_11_3_0]) {
SEL selector = sel_getUid("_startAssistingNode:userIsInteracting:blurPreviousNode:changingActivityState:userObject:");
@rizwan95
rizwan95 / gist:2276405d2ffea62b5d8eb91b93aa0fff
Created March 10, 2018 15:47
UIImage to binary matrix image converter.
import UIKit
import Accelerate
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
let imageForConversion = #imageLiteral(resourceName: "InputImage")
@rizwan95
rizwan95 / backbutton.txt
Created January 11, 2016 15:08
Android back button exit
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.addCategory(Intent.CATEGORY_HOME);
startActivity(intent);
finish();
@rizwan95
rizwan95 / parsetoretrieve.txt
Created January 11, 2016 14:52
Parse Code to retrieve Objects in android
ParseQuery<ParseObject> query = ParseQuery.getQuery("Login_Class");
query.whereEqualTo("Username", username_text);
query.whereEqualTo("Password", password_text);
query.getFirstInBackground(new GetCallback<ParseObject>() {
public void done(ParseObject object, ParseException e) {
if (object == null) {
Log.d("score", "The getFirst request failed.");
} else {
Log.d("score", "Retrieved the object.");
}
@rizwan95
rizwan95 / gist:ead7c43557ed2704f0b8
Created September 24, 2015 05:51
Get data from PFObject
let query = PFQuery(className:"TestObject")
query.getObjectInBackgroundWithId("wl79cMD28y") {
(gameScore: PFObject?, error: NSError?) -> Void in
if error == nil {
print(gameScore!.objectForKey("latitude") as! String)
} else {
print(error)
}