Skip to content

Instantly share code, notes, and snippets.

View bishalg's full-sized avatar
🏠
Working from home

Bishal Ghimire bishalg

🏠
Working from home
View GitHub Profile
@ryuichis
ryuichis / gist:755e6297aec13c900cdf
Last active June 4, 2022 05:38 — forked from gavrix/gist:5054182
Script integrating OCLint into XCode. Put it in "Run script" build phase.
source ~/.bash_profile
cd ${SRCROOT}
xcodebuild clean
xcodebuild | xcpretty -r json-compilation-database
oclint-json-compilation-database -- -report-type xcode
@kusalshrestha
kusalshrestha / UIView+Extensions.swift
Created June 15, 2016 17:50
Making transparent background (Esp. for UItextField)
extension UIView {
func makeTransparentView(withOpacity alphaValue: CGFloat, color: UIColor) {
let backgroundView = UIView()
self.superview?.insertSubview(backgroundView, belowSubview: self)
self.backgroundColor = UIColor.clearColor()
backgroundView.alpha = alphaValue
backgroundView.backgroundColor = color
backgroundView.layer.cornerRadius = self.layer.cornerRadius
@steipete
steipete / ios-xcode-device-support.sh
Last active May 11, 2025 13:30
Using iOS 15 devices with Xcode 12.5 (instead of Xcode 13)
# The trick is to link the DeviceSupport folder from the beta to the stable version.
# sudo needed if you run the Mac App Store version. Always download the dmg instead... you'll thank me later :)
# Support iOS 15 devices (Xcode 13.0) with Xcode 12.5:
sudo ln -s /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/15.0 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport
# Then restart Xcode and reconnect your devices. You will need to do that for every beta of future iOS versions
# (A similar approach works for older versions too, just change the version number after DeviceSupport)
@0xced
0xced / Emoji-iOS-10.0-14A5322e.json
Created August 8, 2016 22:38
Emoji from iOS beta 4 (14A5322e)
{
"People" : [
{
"Symbol" : "😀",
"Name" : "GRINNING FACE"
},
{
"Symbol" : "😬",
"Name" : "GRIMACING FACE"
},
@The0racle
The0racle / NSFetchedResultsController+SafeObjectAtIndexPath
Last active September 3, 2021 22:42
NSFetchedResultsController extension for safely retrieving objects without raising 'NSInternalInconsistencyException'.
//
// NSFetchedResultsController+SafeObjectAtIndexPath.swift
// This extension prevents the 'no object at index in section at index' exception.
//
// Copyright (c) 2016 Thiago Pereira
// MIT License, http://www.opensource.org/licenses/mit-license.php
import Foundation
extension NSFetchedResultsController{
# Merge Script
# 1
# Set bash script to exit immediately if any commands fail.
set -e
# 2
# Setup some constants for use later on.
FRAMEWORK_NAME="BrandingFramework"
@asmallteapot
asmallteapot / Dictionary.Value+RangeReplaceableCollection.swift
Last active March 28, 2023 07:40
Swift: Append an element to an array in a dictionary value, creating the array/value if needed
import Foundation
extension Dictionary where Value: RangeReplaceableCollection {
public mutating func append(element: Value.Iterator.Element, toValueOfKey key: Key) -> Value? {
var value: Value = self[key] ?? Value()
value.append(element)
self[key] = value
return value
}
}
@damienlaughton
damienlaughton / UIAccessorizedTextField.swift
Created March 28, 2018 15:16
UIAccessorizedTextField is an iOS friendly alternative to the drop down list
//
// UIAccessorizedTextField.swift
// AccessorizedTextField
//
// Created by Damien Laughton on 28/03/2018.
// 2018 Mobilology Limited. No rights reserved.
//
import Foundation
import UIKit
@TonsOfFun
TonsOfFun / docker-compose.yml
Created May 14, 2018 16:17
Crypto Smart Camera POC
version: '3'
services:
miner:
image: cryptotrust/rpi-cpuminer-multi
command: "cpuminer -u ${EMAIL} -a ${ALGO} -o stratum+tcp://${URL}:${PORT} -t ${THREADS}"
camera:
image: ricklon/rpi-opencv
command: python motion_capture.py
volumes:
- .:/greenthumb-rails
import Foundation
import UIKit
struct ViewStyle<T> {
let style: (T) -> Void
}
let filled = ViewStyle<UIButton> {
$0.setTitleColor(.white, for: .normal)
$0.backgroundColor = .red