Skip to content

Instantly share code, notes, and snippets.

View randhirraj3130's full-sized avatar

Randhir Raj randhirraj3130

View GitHub Profile
@randhirraj3130
randhirraj3130 / webService.swift
Last active May 3, 2018 08:39
webservice to hit the url and the result
//
// WebService.swift
// ArtCaller
//
// Created by Twistfuture on 6/9/15.
// Copyright (c) 2015 Twist. All rights reserved.
//
import Foundation
import UIKit
@randhirraj3130
randhirraj3130 / alertViewController.m
Created April 4, 2017 11:15
my custom alertview controller
// add text field in alert view controller
UIAlertController * alertController = [UIAlertController alertControllerWithTitle: @"Login"
message: @"Input username and password"
preferredStyle:UIAlertControllerStyleAlert];
[alertController addTextFieldWithConfigurationHandler:^(UITextField *textField) {
textField.placeholder = @"name";
textField.textColor = [UIColor blueColor];
textField.clearButtonMode = UITextFieldViewModeWhileEditing;
textField.borderStyle = UITextBorderStyleRoundedRect;
@randhirraj3130
randhirraj3130 / facebookLogin.swift
Last active April 5, 2017 06:08
facebook login in swift
// facebook login in swift 3.0
// the following code into info.plist
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
@randhirraj3130
randhirraj3130 / facebookLogin.m
Created April 5, 2017 06:14
facebook login in objective c
// add the following code in to info.plist
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>fb1801381186770425</string>
</array>
</dict>
</array>
@randhirraj3130
randhirraj3130 / instagramLogin.swift
Created April 5, 2017 06:37
instagram login in swift 3
// add the webview to your view controller add call web view delegate
// register your app into instagram
// add following code in to button action
let clientID = "aef611af2a1e4806a7de8c0aca13daac"
let redirect_uri = "http://weebook.in/"
let getAccessToken = "https://api.instagram.com/oauth/authorize/?client_id=\(clientID)&redirect_uri=\(redirect_uri)&response_type=token"
self.InstagramWebView.loadRequest(NSURLRequest(url: NSURL(string:getAccessToken as String)! as URL) as URLRequest)
// delegate function of weview
@randhirraj3130
randhirraj3130 / webService.m
Created April 7, 2017 06:54
how to send data from server in objective c
-(void)sendData:(NSString*)email : (NSString*)password :(NSString*)user_id : (NSString*)urlString : (NSString*)name {
NSLog(@"sendData");
NSURL *url = [NSURL URLWithString:urlString];
NSMutableURLRequest * urlRequest = [NSMutableURLRequest requestWithURL:url];
NSString *dataString = [NSString stringWithFormat:@"email=%@&password=%@&id=%@",email,password,user_id];
NSData *requestData = [dataString dataUsingEncoding:NSUTF8StringEncoding];
@randhirraj3130
randhirraj3130 / callwebservice.swift
Last active November 7, 2017 14:30
how to send data on server in ios
func sendData()
{
let old_price = Price.text!
UserDefaults.standard.setValue(old_price, forKey: "old_price")
let prs = [
"coupon_code": CoupanField.text! as String ,
"order_price" : "\(final_price)"
] as [String:String]
Service.Start(VC: self,dic: prs, url: "\(GlobalVariable.serverName)coupon.php", onCompletion: { result in
print("result \(result)")
@randhirraj3130
randhirraj3130 / showToast.cs
Created June 6, 2017 06:11
how to show the toast the in unity for android devices
public static void showToast(string text)
{
if (Application.platform == RuntimePlatform.Android) {
AndroidJavaClass unityPlayer = new AndroidJavaClass ("com.unity3d.player.UnityPlayer");
AndroidJavaObject currentActivity = unityPlayer.GetStatic<AndroidJavaObject> ("currentActivity");
AndroidJavaClass Toast = new AndroidJavaClass ("android.widget.Toast");
AndroidJavaObject javaString = new AndroidJavaObject ("java.lang.String", text);
AndroidJavaObject context = currentActivity.Call<AndroidJavaObject> ("getApplicationContext");
AndroidJavaObject toast = Toast.CallStatic<AndroidJavaObject> ("makeText", context, javaString, Toast.GetStatic<int> ("LENGTH_SHORT"));
@randhirraj3130
randhirraj3130 / TwitterLogin.m
Created June 21, 2017 08:18
twitter login in objective-c
//follow to following steps to get twitter login
step1- register your app on twitter dashboard
step 2- add following code in info.plist betbeen <dict> and </dict>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>twitterkit-<consumerKey></string>
@randhirraj3130
randhirraj3130 / SimpleJSON.cs
Created July 12, 2017 12:38
how to send data on server in unity c#
//#define USE_SharpZipLib
#if !UNITY_WEBPLAYER
#define USE_FileIO
#endif
/* * * * *
* A simple JSON Parser / builder
* ------------------------------
*
* It mainly has been written as a simple JSON parser. It can build a JSON string