Skip to content

Instantly share code, notes, and snippets.

View phynet's full-sized avatar
🤘
I said yeah.

Sofia Swidarowicz phynet

🤘
I said yeah.
View GitHub Profile
@phynet
phynet / resetXcode.sh
Created May 19, 2020 15:51 — forked from maciekish/resetXcode.sh
Reset Xcode. Clean, clear module cache, Derived Data and Xcode Caches. You can thank me later.
#!/bin/bash
killall Xcode
xcrun -k
xcodebuild -alltargets clean
rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang/ModuleCache"
rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang.$(whoami)/ModuleCache"
rm -rf ~/Library/Developer/Xcode/DerivedData/*
rm -rf ~/Library/Caches/com.apple.dt.Xcode/*
open /Applications/Xcode.app
https://tonyxu.io/posts/2018/ultimate-way-to-beautify-mac-terminal-and-recommendations-for-plugins/
@phynet
phynet / show_view_controller_using_navigation_stack.swift
Created July 26, 2018 15:14
presenting a new VC from a modal and setting the navigation stack to other VC
func primaryButtonPressed() {
weak var pvc = self.presentingViewController
dismiss(animated: true, completion: {
let myTripsView: MyTripsHomeViewController = ModulesAssembler().resolve()
let home: ODGBaseHomeViewController = ODGBaseHomeViewController()
if var navstack = myTripsView.navigationController?.viewControllers {
navstack.append(contentsOf: [home])
myTripsView.navigationController?.setViewControllers(navstack, animated: true)
//: Playground - noun: a place where people can play
//Subscript: shortcut for accessing the member elements in a collection, list, or sequence.
import UIKit
//#1
struct TimesTable {
let multiplier: Int
subscript(index: Int) -> Int {
return multiplier * index
@phynet
phynet / elm-swift-redux.mkd
Last active May 13, 2018 17:25
elm-swift-redux info
  Elm uses the functional reactive programming style and purely functional graphical layout to
  build user interface without any destructive updates. It enforces a “model view update”
  architecture, where the update has the following signature: (action, state) -> state 

http://www.appventure.me/2016/10/14/reswift-pattern/

@phynet
phynet / TableDataSource.mkd
Created April 22, 2018 19:37
This class is a simple, immutable, declarative data source for UITableView
 import UIKit

    /// This class is a simple, immutable, declarative data source for UITableView
    final class TableDataSource<V, T> : NSObject, UITableViewDataSource where V: UITableViewCell {

      typealias CellConfiguration = (V, T) -> V

      private let models: [T]
      private let configureCell: CellConfiguration
@phynet
phynet / Emoji-markdown.md
Last active March 31, 2018 18:37 — forked from rxaviers/gist:7360908
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:
import Foundation
public struct Log
{
public static var isEnabled = true
public static func debug(_ m: @autoclosure ()->String, _ file: Any? = #file, _ f: String = #function, _ line: UInt = #line) {
print(m(), file ?? "", f, line)
}
   brew tap wix/brew

This line is for GNU instalation, because old syntaxis uses POSIX and to run new scripts is necessary to use GNU

    brew install gnu-sed grep --with-default-names

Update new commands for mac that uses GNU

    brew install bash

chsh -s /usr/local/bin/bash

@phynet
phynet / insetsForLabel.m
Created October 9, 2017 14:05
Class to create insets in UILabel
#import "RLInsetsLabel.h"
#import "UIView+Utils.h"
@implementation RLInsetsLabel
- (void)awakeFromNib {
[super awakeFromNib];
self.edgeInsets = UIEdgeInsetsMake(self.topEdge, self.leftEdge, self.bottomEdge, self.rightEdge);
}
- (id)initWithFrame:(CGRect)frame {