Skip to content

Instantly share code, notes, and snippets.

View JagCesar's full-sized avatar
👨‍💻
☕️

César Pinto Castillo JagCesar

👨‍💻
☕️
View GitHub Profile
//
// StandByMargins.swift
//
// Created by Kyle Bashour on 8/29/23.
//
import SwiftUI
extension View {
func standByMargins() -> some View {
@roddymunro
roddymunro / ListButton.swift
Created July 13, 2023 17:19
watchOS cell background
struct ListsView: View {
var body: some View {
List(selection: $selectedList) {
ForEach(lists) { list in
Button(action: { }) {
ListButtonLabel(list: list)
}
.buttonStyle(.plain)
.listRowInsets(EdgeInsets())
@Berhtulf
Berhtulf / ci_post_xcodebuild.sh
Last active October 30, 2024 07:01
Xcode Cloud - CI/CD Push tag to Github
# 1. Create 'ci_scripts' folder in your main project directory
# 2. Create 'ci_post_xcodebuild.sh' inside of it
# 3. Make it an executable by running 'chmod +x $ci_post_xcodebuild.sh'
set -e # fails build if any command fails
if [ ${CI_XCODEBUILD_EXIT_CODE} != 0 ]
then
exit 1
fi
let json = """
{
"foo": "bar",
"baz": null
}
"""
struct Type: Decodable {
let type: String
let value: String?
@xeloader
xeloader / unfollow-all.md
Last active October 15, 2021 04:08
Unfollow everyone on LinkedIn

Unfollow everyone on Social Media

Unfollow everyone on LinkedIn

LinkedIn is even more clickbait than Facebook nowadays. Adios. 💣

Visit https://www.linkedin.com/feed/following/

Scroll down to load all of your contacts

Open developer console, run the following

// based on this answer 'http://stackoverflow.com/a/36016798'
class LeftAlignedCollectionViewFlowLayout: UICollectionViewFlowLayout {
override func layoutAttributesForElements(in rect: CGRect) -> [UICollectionViewLayoutAttributes]? {
let attributes = super.layoutAttributesForElements(in: rect)
var leftMargin = sectionInset.left
var maxY: CGFloat = -1.0
attributes?.forEach { layoutAttribute in
if layoutAttribute.frame.origin.y >= maxY {
extension Array {
var powerSet: [[Element]] {
guard !isEmpty else { return [[]] }
return Array(self[1...]).powerSet.flatMap { [$0, [self[0]] + $0] }
}
}
print([1,2,3,4].powerSet) // -> [[], [1], [2], [1, 2], [3], [1, 3], [2, 3], [1, 2, 3], [4], [1, 4], [2, 4], [1, 2, 4], [3, 4], [1, 3, 4], [2, 3, 4], [1, 2, 3, 4]]
@beccadax
beccadax / UINavigationItem+KVO.m
Created July 6, 2013 00:52
Makes the various UINavigationItem methods for setting bar items KVO-compliant.
//
// UINavigationItem+KVO.m
// Feeder
//
// Created by Brent Royal-Gordon on 7/5/13.
// Copyright (c) 2013 Architechies. All rights reserved.
//
#import "UINavigationItem+KVO.h"
@steipete
steipete / PSPDFUIKitMainThreadGuard.m
Last active May 27, 2024 12:11
This is a guard that tracks down UIKit access on threads other than main. This snippet is taken from the commercial iOS PDF framework http://pspdfkit.com, but relicensed under MIT. Works because a lot of calls internally call setNeedsDisplay or setNeedsLayout. Won't catch everything, but it's very lightweight and usually does the job.You might n…
// Taken from the commercial iOS PDF framework http://pspdfkit.com.
// Copyright (c) 2014 Peter Steinberger, PSPDFKit GmbH. All rights reserved.
// Licensed under MIT (http://opensource.org/licenses/MIT)
//
// You should only use this in debug builds. It doesn't use private API, but I wouldn't ship it.
// PLEASE DUPE rdar://27192338 (https://openradar.appspot.com/27192338) if you would like to see this in UIKit.
#import <objc/runtime.h>
#import <objc/message.h>
@artero
artero / launch_sublime_from_terminal.markdown
Last active September 12, 2024 02:13 — forked from olivierlacan/launch_sublime_from_terminal.markdown
Launch Sublime Text 2 from the Mac OS X Terminal

Launch Sublime Text 2 from the Mac OS X Terminal

Sublime Text 2 ships with a CLI called subl (why not "sublime", go figure). This utility is hidden in the following folder (assuming you installed Sublime in /Applications like normal folk. If this following line opens Sublime Text for you, then bingo, you're ready.

open /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl

You can find more (official) details about subl here: http://www.sublimetext.com/docs/2/osx_command_line.html

Installation