This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension UILabel { | |
func textWidth() -> CGFloat { | |
return UILabel.textWidth(label: self) | |
} | |
class func textWidth(label: UILabel) -> CGFloat { | |
return textWidth(label: label, text: label.text!) | |
} | |
class func textWidth(label: UILabel, text: String) -> CGFloat { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Swift version of the code from http://stackoverflow.com/a/30335594/1986600 | |
import CoreTelephony | |
override func awakeFromNib() { | |
super.awakeFromNib() | |
let isCapableToCall: Bool | |
if UIApplication.sharedApplication().canOpenURL(NSURL(string: "tel://")!) { | |
// Check if iOS Device supports phone calls |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func validate(response: HTTPResponse, forRequest request: HTTPRequest) -> HTTPResponseValidatorResult { | |
if !(200..<300).contains(response.statusCode) { | |
// invalid response, we want to fail the request with error | |
throw HTTPError.invalidResponse | |
} | |
return .nextValidator // everything is okay, move to next validator | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ProductModal extends ViewModel { | |
private MutableLiveData<Integer> count; | |
public MutableLiveData<Integer> getCount() { | |
if (count == null) { | |
count = new MutableLiveData<>(); | |
} | |
return count; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MultiLiveMain extends AppCompatActivity implements View.OnClickListener { | |
TextView show_products, pieceText; | |
AppCompatActivity activity; | |
ProductModal productModal; | |
Observer<Integer> productObserver; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
tools:context=".MainActivity"> | |
<ListView | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM node:12 | |
#Proje nodejs 12 ile çalışması için | |
WORKDIR /home/node/app | |
#proje yolu belirlenir | |
COPY Dijital /home/node/app | |
# Docker içine kopyalanır | |
RUN npm install | |
# Docker imajı proje halindeyken çalıştırır | |
CMD npm run start | |
# Container çalıştırılırken CMD çalışır. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express'); | |
const app = express(); | |
app.get('/',function(req,res){ | |
res.status(200).send(JSON.stringify({ | |
result:"200", | |
message:"api get çalıştı" | |
})) | |
}) | |
app.post('/',function(req,res){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "nodejs-api", | |
"version": "1.0.0", | |
"description": "", | |
"main": "main.js", | |
"scripts": { | |
"start": "node app.js" | |
}, | |
"author": "", | |
"license": "ISC", |
NewerOlder