Skip to content

Instantly share code, notes, and snippets.

View gauravkeshre's full-sized avatar

Gaurav K gauravkeshre

View GitHub Profile
How to replace text everywhere in Git
There is a Git command, filter-branch, which works wonders for changing the history of a repository, but it’s difficult to use because it forces you to know how Git works under the hood. Instead there is this little free tool, BFG Repo-Cleaner, which is intuitive, fast and recommended.
Check that there are some occurrences of your string
The first thing to do is to check that the repository contains the string you want to replace with another string. This will help later to make sure you effectively replaced it.
andrea at Lock-and-Stock in ~/dev/ruby
$ git clone git@gitlab.com:aercolino/your-repository.git
andrea at Lock-and-Stock in ~/dev/ruby
@bryanbraun
bryanbraun / git-branching-diagram.md
Last active July 5, 2024 14:18
Example Git Branching Diagram

Example Git Branching Diagram

You can use this diagram as a template to create your own git branching diagrams. Here's how:

  1. Create a new diagram with diagrams.net (formerly draw.io)
  2. Go to File > Open From > URL
  3. Insert this url (it points to the xml data below): https://gist.githubusercontent.com/bryanbraun/8c93e154a93a08794291df1fcdce6918/raw/bf563eb36c3623bb9e7e1faae349c5da802f9fed/template-data.xml
  4. Customize as needed for your team.

@ronsims2
ronsims2 / README.md
Last active October 14, 2023 12:34
A script that will confirm if a specified IPA file was signed with the specified certificate.

Verify an IPA's Signing Certificate

Example :

python ipa_cert_checker.py /Users/janedoe/Documents/Foobar.ipa /Users/janedoe/Documents/barfoo.cer

If any matching certs are found, the script will print something similar to:

Certificate (1) beginning: XCVBNM... matches the specified certificate: /Users/janedoe/Documents/barfoo.cer

//
// Copyright (c) 2016, 2018 Nikolai Ruhe. All rights reserved.
//
import Foundation
public extension FileManager {
/// Calculate the allocated size of a directory and all its contents on the volume.
@kraigspear
kraigspear / NEHotspotConfigurationManager.swift
Created October 11, 2017 09:19
Connect to a WIFI hotspot programmatically in iOS 11
//
// ViewController.swift
// NetworkTest
//
// Created by Kraig Spear on 10/10/17.
// Copyright © 2017 spearware. All rights reserved.
//
import UIKit
import NetworkExtension
@tmspzz
tmspzz / NRFileManager.swift
Last active December 12, 2023 06:46
A method to calculate the accumulated size of a directory on the volume in bytes.
public extension FileManager {
/// This method calculates the accumulated size of a directory on the volume in bytes.
///
/// As there's no simple way to get this information from the file system it has to crawl the entire hierarchy,
/// accumulating the overall sum on the way. The resulting value is roughly equivalent with the amount of bytes
/// that would become available on the volume if the directory would be deleted.
///
/// - note: There are a couple of oddities that are not taken into account (like symbolic links, meta data of
/// directories, hard links, ...).
@inorganik
inorganik / randomLocations.swift
Created June 22, 2017 14:37
Return a cluster of random locations around a given location
import Foundation
import CoreLocation
struct randomLocations {
// create random locations (lat and long coordinates) around user's location
func getMockLocationsFor(location: CLLocation, itemCount: Int) -> [CLLocation] {
func getBase(number: Double) -> Double {
return round(number * 1000)/1000
final class Example {
func emptyTask() {
TODO
}
func slowTask() {
FIXME
print("This still executes")
}
@kharrison
kharrison / SwiftIntegerGuide.swift
Created February 17, 2017 16:43
Swift Integer Quick Guide
// -------------------------------------
// Swift Integer Quick Guide
// -------------------------------------
// Created by Keith Harrison http://useyourloaf.com
// Copyright (c) 2017 Keith Harrison. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
@DMCApps
DMCApps / UIAlertController+Builder
Last active October 26, 2022 20:01
Builder pattern extension for the UIAlertController
//
// UIAlertController+Builder.swift
//
// Created by Daniel Carmo on 2016-12-30.
// Copyright © 2016 DMCApps Inc. All rights reserved.
//
import Foundation
import UIKit