Skip to content

Instantly share code, notes, and snippets.

View amine2233's full-sized avatar

Amine Bensalah amine2233

View GitHub Profile
@danieldogeanu
danieldogeanu / RenameGitBranch.md
Last active March 1, 2025 12:41
How to rename your Git master branch to main.

To rename your Git master branch to main, you must do the following steps:

  1. Navigate to your repository in the command line and issue the following commands: - git branch -m master main - git push -u origin main

  2. Change your default branch on GitHub by going to your GitHub repository in your browser, and navigate to Settings > Branches and click on the dropdown and switch from master to main and click Update (this will only show if you have two or more branches). The main branch is now your default branch.

  3. Update the tracking of the branch from your command line with the following command: - git branch -u origin/main main

import XCTest
public enum TestWaitResult {
case wait, success
}
public enum WaitTimeoutCondition {
case fail, skip
}
@viteinfinite
viteinfinite / aws-deploy.sh
Last active December 2, 2020 09:41
Swift Lambda build and package scripts
# Install the jq tool (https://stedolan.github.io/jq/)
# It'll be used to parse the response of the aws cli commands
JQ_PATH=./scripts/jq
if [ ! -f "$JQ_PATH" ]; then
echo "Installing jq"
curl -L https://github.com/stedolan/jq/releases/download/jq-1.6/jq-osx-amd64 --output $JQ_PATH
chmod +x $JQ_PATH
fi
# Create an AWS IAM Role
@DenTelezhkin
DenTelezhkin / SwiftUI code generation template for SwiftGen.md
Last active April 29, 2022 07:36
SwiftUI code generation template for SwiftGen

Example of generated code

internal extension Color {
  // Assets.xcassets
  static var midnightBlue : Color { Color("midnightBlue", bundle: BundleToken.bundle) }
}

internal extension Image {
// Assets.xcassets
@mecid
mecid / Calendar.swift
Last active May 15, 2025 03:19
SwiftUI Calendar view using LazyVGrid
import SwiftUI
extension Calendar {
func generateDates(
inside interval: DateInterval,
matching components: DateComponents
) -> [Date] {
var dates: [Date] = []
dates.append(interval.start)
import Combine
import UIKit
public protocol CombineCompatible {}
// MARK: - UIControl
public extension UIControl {
final class Subscription<SubscriberType: Subscriber, Control: UIControl>: Combine.Subscription where SubscriberType.Input == Control {
private var subscriber: SubscriberType?
private let input: Control
// the State of the feedback loop
struct Levels {
let left: Int
let right: Int
}
// the transition requests of the feedback loop
enum Event {
case increaseLeft
case decreaseLeft
//
// ContentView.swift
// Store
//
// Created by Chris Eidhof on 05.02.20.
// Copyright © 2020 Chris Eidhof. All rights reserved.
//
import SwiftUI
@IanKeen
IanKeen / Decodable+Empty.swift
Created January 23, 2020 19:10
Custom Decoder that can be used to create empty Decodable instances
import Foundation
extension Decodable {
public static func empty() throws -> Self {
return try Self(from: EmptyDecoder())
}
}
private class EmptyDecoder: Decoder {
let codingPath: [CodingKey] = []
@kutzhanov
kutzhanov / .gitlab-ci.yml
Last active September 11, 2024 15:19
Deploy Docker container into AWS ECS Fargate using Gitlab CI
image: docker:19.03
variables:
REPOSITORY_URL: <AWS_ACCOUNT_ID>.dkr.ecr.<REGION_NAME>.amazonaws.com/<ECR_REPOSITORY_NAME>
REGION: <REGION_NAME>
TASK_DEFINITION_NAME: <TASK_DEFINITION_NAME>
CLUSTER_NAME: <CLUSTER_NAME>
SERVICE_NAME: <SERVICE_NAME>
CPU: <CPU>
MEMORY: <MEMORY>