Skip to content

Instantly share code, notes, and snippets.

View icanswiftabit's full-sized avatar
⌨️

Błażej Wdowikowski icanswiftabit

⌨️
View GitHub Profile
@icanswiftabit
icanswiftabit / bundlerInIOS.MD
Last active April 6, 2024 14:54
How to use bundler with iOS projects

#How to use Bundler with iOS projects

You probably stuck with situation when after finishing for example bundle install && bundle exec pod install Bundler couldn't access gems which he just download. Some of you may think "RVM is the answer!" and yes it is, but what if it is not?

##Don't use macOS's gems. Just DON'T.

  1. Establish that you will don't use macOS's gems and RVM.
  2. Go to your_app_dir
  3. Make sure you have Gemfile if not create one
@icanswiftabit
icanswiftabit / readme.md
Last active January 7, 2017 17:35
Set default program for text edition in macOS 10.11+
  • In terminal type
defaults write com.apple.LaunchServices/com.apple.launchservices.secure LSHandlers -array-add \
'{LSHandlerContentType=public.plain-text;LSHandlerRoleAll=<program bundle id>;}'

ex. for SublimeText 2

@icanswiftabit
icanswiftabit / bash command for using iCloud password
Created October 17, 2016 14:51
When iCloud prompt is not showing in user & groups, type this command to.
sudo dscl . append /Users/`users` AuthenticationAuthority ";AppleID;[email protected]"
1. Go to `/Applications/Xcode.app/Contents/Frameworks/IDEKit.framework/Resources`
2. Open `IDETextKeyBindingSet.plist` in text editor or `sudo open`
3a. Text editor variant:
At end add dict
<key>Custom</key>
<dict>
<key>Duplicate Current Line</key>
<string>selectParagraph:, copy:, moveToEndOfLine:, insertParagraphSeparator:, pasteAndPreserveFormatting:, deleteBackward:, moveToBeginningOfText:</string>
<key>Delete Current Line</key>
<string>deleteParagraph:</string>
@icanswiftabit
icanswiftabit / 0_reuse_code.js
Created June 29, 2016 05:37
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@icanswiftabit
icanswiftabit / Custom UIView from xib.md
Last active June 27, 2016 14:52
How to create and use reusable UIView.
  1. After creating CustomView.Swift & CustomView.xib in CustomView.xib as Class in File's Owner position set CustomView
  2. Then add func commonInit to init(frame:) and init(aCoder:) and you're ready to go.

CustomView.Swift

class CustomView : UIView {
    @IBOutlet weak private var contentView:UIView!
    // other outlets

override init(frame: CGRect) { // for using CustomView in code

  1. Create new class extending UITableViewCell with xib
  2. In ViewController register nib for this class

Example

DirectionViewCell.swift

class DirectionViewCell: UITableViewCell{

@IBOutlet var stopNameLabel: UILabel!

@icanswiftabit
icanswiftabit / Equatable.swift
Last active June 29, 2016 05:39
Implementation of Equatable protocol
class Category: Object,Equatable {
dynamic var id:String = ""
dynamic var name:String = ""
override static func primaryKey() -> String? {
return "id"
}
func config(id:String,name:String){
self.id = id
@icanswiftabit
icanswiftabit / gist:dc3044768dd0971f8de4
Last active August 29, 2015 14:25
Solution for correct tint color in UISearchBar
searchBar.backgroundImage = UIImage()
searchBar.tintAdjustmentMode = UIViewTintAdjustmentMode.Normal
searchBar.barTintColor = Utils.tintColor() //Your desired tint color
@icanswiftabit
icanswiftabit / gist:8292245
Created January 6, 2014 23:53
second Argument type
typedef void (afterPlayingFunc)(void* clientData);
Boolean startPlaying(MediaSource& source,
afterPlayingFunc* afterFunc,
void* afterClientData);