Skip to content

Instantly share code, notes, and snippets.

View parthjdabhi's full-sized avatar
🎯
Focusing

Parth Dabhi parthjdabhi

🎯
Focusing
View GitHub Profile
@parthjdabhi
parthjdabhi / Utils.java
Created February 1, 2024 14:03
To Retrieve original filename in android for react-native-image-picker
package com.imagepicker;
import android.Manifest;
import android.app.Activity;
import android.content.ClipData;
import android.content.ContentResolver;
import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
@parthjdabhi
parthjdabhi / README.md
Created March 30, 2023 04:58 — forked from Mike-Gough/README.md
Setup new React Native project with Typescript and Storyboard

React Native App Creation Recipe

This is a step-by-step guide to create React Native app.

You will get an application which has;

  • TypeScript
  • Linting
  • Formatting
  • Testing
@parthjdabhi
parthjdabhi / concurrency.swift
Created July 3, 2017 09:06 — forked from werediver/concurrency.swift
Limiting concurrent tasks.
import Foundation
func dispatch_async_batch(tasks: [() -> ()], limit: Int, completion: (() -> ())?) {
if tasks.count > 0 || completion != nil {
let q = dispatch_queue_create("dispatch_async_batch", DISPATCH_QUEUE_CONCURRENT);
let sema = dispatch_semaphore_create(limit);
dispatch_async(q, {
for task in tasks {
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER)
@parthjdabhi
parthjdabhi / FatalError+Ext.swift
Created July 3, 2017 09:05 — forked from werediver/FatalError+Ext.swift
Better `fatalError()`.
import Foundation
func fatalError<T>(@autoclosure message: () -> String = "", file: StaticString = #file, line: UInt = #line) -> T {
fatalError(message(), file: file, line: line)
}
// Demo
protocol ResultType {
@parthjdabhi
parthjdabhi / Api.swift
Created January 2, 2017 08:35 — forked from seyhunak/Api.swift
Swift - JSON API
class API {
let uri = "https://api.com/endpoint" // replace your api endpoint (json)
func getData(completionHandler: ((NSArray!, NSError!) -> Void)!) -> Void {
let url: NSURL = NSURL(string: uri)!
let ses = NSURLSession.sharedSession()
let task = ses.dataTaskWithURL(url, completionHandler: {data, response, error -> Void in
@parthjdabhi
parthjdabhi / main.js
Created January 2, 2017 08:34 — forked from seyhunak/main.js
Targeted Push Notifications: Parse.com Cloud Code
// Use Parse.Cloud.define to define as many cloud functions as you want.
// For example:
Parse.Cloud.define("hello", function (request, response) {
response.success("Hello world!");
});
Parse.Cloud.define("userWithEmailExists", function (request, response) {
var email = request.params.email;
if (email != null && email !== "") {
email = email.trim();
class Brew {
var temp: Float = 0.0
}
class BrewViewModel : NSObject {
var brew = Brew()
dynamic var temp: Float = 0.0 {
didSet {
self.brew.temp = temp
}
@parthjdabhi
parthjdabhi / drive.py
Created October 4, 2016 18:26 — forked from basuke/drive.py
Create the GPX file from origin and destination using the GoogleMap Direction API. You can use this output for simulate the location apps in Xcode.
#
# python drive.py "origin" ["waypoint" ... ] "destination"
#
# i.e. python drive.py "Union Square, San Francisco" "Ferry Building, San Francisco" 'Bay Bridge' SFO
import sys, json, urllib2, md5, os.path, pprint
from math import radians, sin, cos, atan2, pow, sqrt
from urllib import quote_plus
from xml.sax.saxutils import escape
from optparse import OptionParser
//
// FallingStuffAnimationVC.m
// UIGravityBehavior
//
// Created by Mark Parth Dabhi on 06/07/2016.
// Copyright (c) 2014 Parth Dabhi. All rights reserved.
//
#import "FallingStuffAnimationVC.h"