Skip to content

Instantly share code, notes, and snippets.

View canberkozcelik's full-sized avatar

Canberk Ozcelik canberkozcelik

  • Mobiquity Inc. Europe
  • Amsterdam
View GitHub Profile
@canberkozcelik
canberkozcelik / String.swift
Created July 30, 2020 12:59
if you ever asked to do some weird password validation (min 6, max 8 digits, no more than 3 repeating or sequential numbers)
func isValidPassword() -> Bool {
let regex = "\\b(?!.*?(?:0(?:12)|123|234|3(?:45|21)|4(?:56)|5(?:67)|6(?:78)|7(?:89)))(?!.*?(.)\\1{2})[0-9]{6,8}\\b"
let sequentialOrRepeated = NSPredicate(format: "SELF MATCHES %@", regex)
return sequentialOrRepeated.evaluate(with: self)
}
package main
import (
"log"
"net"
"google.golang.org/grpc"
pb "../employee"
)
syntax = "proto2";
// there's also "proto3"
package employeebook;
option java_package = "com.cnb.employeebook";
option java_outer_classname = "EmployeeBookProtos";
service EmployeeService {
// Get all employees
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: grpc_employee.proto
package employeebook
import proto "github.com/golang/protobuf/proto"
import fmt "fmt"
import math "math"
import (
@canberkozcelik
canberkozcelik / EmployeeBookProtos.java
Created September 12, 2018 09:57
generated proto file from employee.proto
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: people.proto
package com.cnb.employeebook;
public final class EmployeeBookProtos {
private EmployeeBookProtos() {}
public static void registerAllExtensions(
com.google.protobuf.ExtensionRegistryLite registry) {
}
@canberkozcelik
canberkozcelik / employee.proto
Last active September 12, 2018 09:39
The protocol buffer file of the employee example
syntax = "proto2";
// there's also "proto3"
package employeebook;
option java_package = "com.cnb.employeebook";
option java_outer_classname = "EmployeeBookProtos";
message Employee {
required string name = 1;
/** ButterKnife Code **/
@BindView(R.id.picture)
ImageView picture;
@BindView(R.id.name)
TextView name;
@BindView(R.id.gender)
TextView gender;
@BindView(R.id.company)
TextView company;
@BindView(R.id.email)
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
-----------------------------------com.example.packagename.Friend.java-----------------------------------
package com.example.packagename;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.Parcelable.Creator;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
[
{
"_id": "5a3d202a2c543f89e3a8fd39",
"index": 0,
"guid": "4867b1ad-504a-443b-96a6-04e4d4fd5b1b",
"isActive": true,
"balance": "$2,869.73",
"picture": "http://placehold.it/32x32",
"age": 33,
"eyeColor": "blue",