Skip to content

Instantly share code, notes, and snippets.

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

Milan Panchal milanpanchal

🏠
Working from home
View GitHub Profile
@albertbori
albertbori / PlaceholderTextView.swift
Last active January 13, 2020 09:25
UITextView support for Placeholder text
import UIKit
import Foundation
@IBDesignable class PlaceholderTextView: UITextView, UITextViewDelegate
{
private let _placeholderColor: UIColor = UIColor(white: 0.78, alpha: 1)
private var _placeholderLabel: UILabel!
@IBInspectable var placeholder: String = "" {
didSet {
@pedrogimenez
pedrogimenez / swift.swift
Last active February 9, 2017 07:27
swift.swift
func calculateAverage(total: Int, countOfNumbers: Int) -> Int {
return total / countOfNumbers
}
func average(algorithm: (Int, Int) -> Int, numbers: Int...) -> Int {
var countOfNumbers = 0
var total = 0
for number in numbers {
total += number
Arguments passed on Launch:
-NSViewShowAlignmentRects YES
-NSShowAllViews YES
Debuging:
-[NSView _subtreeDescription]
-[NSView constraintsAffectingLayout:forOrientation:]
-[NSWindow visualizeConstraints:]
@lttlrck
lttlrck / gist:9628955
Created March 18, 2014 20:34
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
@dirtyhenry
dirtyhenry / gist:7547064
Created November 19, 2013 15:27
iOS code that: 1/ validates an email found in a UITextField 2/ check chances of spelling mistakes
- (NSArray *)allMyContacts {
// cf. http://stackoverflow.com/questions/12083643/how-do-i-correctly-use-abaddressbookcreatewithoptions-method-in-ios-6
CFErrorRef error = nil;
ABAddressBookRef addressBook = ABAddressBookCreateWithOptions(NULL, &error);
__block BOOL accessGranted = NO;
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
ABAddressBookRequestAccessWithCompletion(addressBook, ^(bool granted, CFErrorRef error) {
accessGranted = granted;
@rxaviers
rxaviers / gist:7360908
Last active May 18, 2024 09:55
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@henrik
henrik / SearchBarStyler.h
Created June 12, 2010 19:21
Enable the Return key in a UISearchBar even when its text is empty.
// By Henrik Nyh <http://henrik.nyh.se> 2010-06-12 under the MIT license.
#import <Foundation/Foundation.h>
@interface SearchBarStyler : NSObject {
}
+(void)enableReturnKeyWithNoText:(UISearchBar *)searchBar;
@end