Skip to content

Instantly share code, notes, and snippets.

View ManWithBear's full-sized avatar
🐻
Bear with it

Denis Bogomolov ManWithBear

🐻
Bear with it
View GitHub Profile
@ManWithBear
ManWithBear / liquidGenerator.rb
Created April 25, 2017 11:41
Generate files from provided template
require 'liquid'
require 'fileutils'
input_file = File.absolute_path(ARGV[0])
@template = Liquid::Template.parse(File.open(input_file, "r").read)
renderedTemplate = @template.render()
extn = File.extname(input_file)
output_file = File.dirname(input_file) + "/" + File.basename(input_file, extn)
File.open(output_file, "w") {|f| f.write(renderedTemplate) }
@objc protocol Refreshable
{
/// The refresh control
var refreshControl: UIRefreshControl? { get set }
/// The table view
var tableView: UITableView! { get set }
/// the function to call when the user pulls down to refresh
@objc func handleRefresh(_ sender: Any);
@ManWithBear
ManWithBear / generateUserStoryModule
Last active May 6, 2017 20:38
Generate module of specific user story by using generamba
#!/bin/bash/
testPath="{ project name }Tests/PresentationLayer/UserStories/$1"
projectPath="{ project name }TODO/PresentationLayer/UserStories/$1"
generamba gen "$2" { template name } --test_path "$testPath" --module_path "$projectPath"
@ManWithBear
ManWithBear / WMO.md
Last active August 31, 2017 12:47
Whole module optimization in swift

Whole module optimization does exactly what we want. It compiles all the files in one go. The problem with whole module optimization is that it optimizes, so its pretty slow. But if you add a user-defined custom flag; SWIFT_WHOLE_MODULE_OPTIMIZATION and set it to yes, as well as set the optimization level to none. It will do whole module optimization without optimizing. And it'll be super fast.
by https://www.skilled.io/u/swiftsummit/swift-with-a-hundred-engineers

@ManWithBear
ManWithBear / VersionBump.sh
Created May 29, 2017 13:16
Build version bump in yyyymmddxx format
releaseName=`date '+%Y%m%d'`
oldRelease=`cat {project name}/SupportFiles/Info.plist | sed -n '/CFBundleVersion/{n;p;}' | cut -d '>' -f2 | cut -d '<' -f1`
oldTemp=${oldRelease:0:8}
if [ $oldTemp == $releaseName ]
then
suffix=${oldRelease:8}
suffix=$(($suffix + 1))
printf -v suffix "%02d" $suffix
else
suffix=01
@ManWithBear
ManWithBear / xcode.md
Last active September 25, 2018 08:35
Move open bracket on new line in default xcode snippets
  1. Find SystemCodeSnippets.codesnippets file. For Xcode8:
    /Applications/Xcode.app/Contents/Frameworks/IDEKit.framework/Resources/SystemCodeSnippets.codesnippets
  2. Make save copy of snippets cp SystemCodeSnippets.codesnippets ~/Desktop/
  3. Open in vim: sudo vim SystemCodeSnippets.codesnippets
  4. Move every open bracket on new line :%s/ {/\r{/g
  5. Save and close :wq
  6. Restart Xcode
  7. ????
  8. PROFIT!
@ManWithBear
ManWithBear / Build_timing.md
Created August 2, 2017 08:36
Show duration of last action in toolbar
@ManWithBear
ManWithBear / .bash_profile
Last active November 29, 2019 23:14
My work bash_profile
source ~/.profile
source ~/.git-completion.bash
source ~/.git-prompt.sh
source ~/tools/arcanist/resources/shell/bash-completion
export PATH="$PATH:$HOME/tools/arcanist/bin/"
export EDITOR="/usr/bin/vim"
PS1='\[\e[31m\][\[\e[0m\]\W$(__git_ps1 " (\[\e[36m\]%s\[\e[0m\])")\[\e[31m\]]\[\e[0m\]\$ '
alias be='bundle exec'
alias ll='ls -al'
syntax on " syntax highlightnig
set number " add line number
set mouse=a " enable mouse
set ruler " cursor position in bottom right corner
set tabstop=4 " number of spaces per tab
set autoindent " start new line on same indentation
set expandtab " use spaces instead of tabs
filetype on " try to understand type of file for highlighting
infix operator ⎽⟋: AdditionPrecedence
func ⎽⟋(_ left: Any, _ right: Any) { }
infix operator ⟍⎽: AdditionPrecedence
func ⟍⎽(_ left: Any, _ right: Any) { }
let ¯ = ""
let ツ = ""
let dunno = ¯⟍⎽(ツ)⎽⟋¯