Skip to content

Instantly share code, notes, and snippets.

View theblixguy's full-sized avatar

Suyash Srijan theblixguy

View GitHub Profile
@theblixguy
theblixguy / str_to_int.cpp
Created February 17, 2017 23:17
String to Integer
#include <iostream>
#include <string>
int main() {
std::string numberString = "1234";
int numberInt = 0;
for (int i = 0; i < numberString.length(); i++) {
numberInt = numberInt * 10 + numberString[i] - '0';
}
std::cout << "String number: " << numberString << std::endl;
struct Point {
let x, y: Int
}
func createPoint() {
let point = Point(x: 0, y: 0)
}
createPoint()
// SwiftUI
Text("Hello World").font(.title).color(.red)
// UIKit
let label = UILabel()
label.text = "Hello World"
label.font = .preferredFont(forTextStyle: .title1)
label.textColor = .red
// Full implementation skipped for brevity
private func createCardView() -> some View {
let backgroundColor = AppColor.cardBackground
return HStack(alignment: .top, spacing: 16) {
createContainer()
Spacer()
createAvatarContainer()
}.frame(height: 135)
.background(backgroundColor)