Skip to content

Instantly share code, notes, and snippets.

@JaviSoto
JaviSoto / swiftlint.yml
Created June 16, 2020 17:29
disallowed_racist_terms_of_art SwiftLint
disallowed_racist_terms_of_art:
name: "Disallowed racist terms of art"
regex: 'blacklist|whitelist|^((?<!git)[^\n])*master(?! (manifest|playlist))|slave'
message: "Please, refrain from using terms which have racist connotations. Consider alternatives such as allow, disallow, primary, secondary..."
severity: error
@jkereako
jkereako / PrintDataAsString.swift
Last active July 27, 2024 06:53
LLDB commands to print a Data object as a String. It only works if the underlying data is actually a String.
// See: http://stackoverflow.com/questions/11531353/viewing-nsdata-contents-in-xcode#25097265
po String(data: data, encoding: .utf8)
// Objective-C equivalent.
// See: http://stackoverflow.com/questions/11531353/viewing-nsdata-contents-in-xcode#19626815
// p (char *)[buffer bytes]
@dtrotzjr
dtrotzjr / openssl-maker.sh
Last active September 27, 2016 21:35 — forked from letiemble/openssl-maker.sh
A bash script to generate "all-in-one" OpenSSL static libraries for OS X and iOS. The script produces fat static libraries (i386,x86_64 for OS X) and (i386,armv7,armv7s,arm64 for iOS) suitable for integration in both OS X and iOS project.
#!/bin/bash
###############################################################################
## ##
## Build and package OpenSSL static libraries for OSX/iOS ##
## ##
## This script is in the public domain. ##
## Creator : Laurent Etiemble ##
## ##
###############################################################################
@santoshrajan
santoshrajan / JSONStringify.swift
Created October 12, 2014 05:36
JSON Stringify in Swift
// Author - Santosh Rajan
import Foundation
let jsonObject: [AnyObject] = [
["name": "John", "age": 21],
["name": "Bob", "age": 35],
]
func JSONStringify(value: AnyObject, prettyPrinted: Bool = false) -> String {
@kristopherjohnson
kristopherjohnson / RoundRectButton.swift
Last active January 4, 2021 14:35
Swift: Custom UIButton subclass that displays a rounded rectangle in the background
import UIKit
/// UIButton subclass that draws a rounded rectangle in its background.
public class RoundRectButton: UIButton {
// MARK: Public interface
/// Corner radius of the background rectangle
public var roundRectCornerRadius: CGFloat = 8 {
@munificent
munificent / gist:9749671
Last active June 23, 2022 04:04
You appear to be creating a new IDE...
You appear to be advocating a new:
[ ] cloud-hosted [ ] locally installable [ ] web-based [ ] browser-based [ ] language-agnostic
[ ] language-specific IDE. Your IDE will not succeed. Here is why it will not succeed.
You appear to believe that:
[ ] Syntax highlighting is what makes programming difficult
[ ] Garbage collection is free
[ ] Computers have infinite memory
[ ] Nobody really needs:
/*
usbdevs - list mounted USB devices & their volume paths on Mac OS X
References:
- http://stackoverflow.com/questions/2459414/osx-how-to-get-a-volume-name-or-bsd-name-from-a-iousbdeviceinterface-or-locati
- http://superuser.com/questions/103755/whats-up-with-stat-on-mac-os-x-darwin-or-filesystems-without-names
- http://stackoverflow.com/questions/1698124/how-to-tell-if-a-given-path-is-mounted-removable-media-in-mac-os-x
- http://developer.apple.com/mac/library/samplecode/VolumeToBSDNode/Introduction/Intro.html