Skip to content

Instantly share code, notes, and snippets.

@dm-z
dm-z / .vimrc
Last active March 14, 2018 00:22
set guifont=SF\ Mono:h14
syntax on
set ruler
set background=dark
colorscheme solarized
highlight LineNr ctermbg=NONE
set ignorecase
set number
set guioptions-=r
au BufReadPost *.podspec set syntax=ruby
abbr -a gchm git checkout master
abbr -a rb review-branch
abbr -a g git
abbr -a ga git add
abbr -a gaa git add --all
abbr -a gapa git add --patch
abbr -a gba git branch -a -v
abbr -a gb git branch
abbr -a gc git commit -v
abbr -a gc! git commit -v --amend
@dm-z
dm-z / ios-questions-interview.md
Last active November 15, 2017 21:24 — forked from arturlector/ios-questions-interview.md
Вопросы на собеседование iOS разработчика.

Вопросы на собеседование iOS разработчика (дополненное издание):

General:

  • Что такое полиморфизм?

  • Что такое *инкапсуляция? Что такое *нарушение инкапсуляции?

  • Чем абстрактный класс отличается от интерфейса?

  • Расскажите о паттерне MVC. Чем отличается пассивная модель от активной?

@dm-z
dm-z / .bash_profile
Last active May 16, 2018 17:20
.bash_profile with colors, git completion and showing active git branch if available
#Showing user name and current git branch
PS1='\[\e[1;31m\]Mac[\[\e[m\]\[\e[1;32m\]\u\[\e[m\]\[\e[1;31m\]]\[\e[m\] \[\e[1;36m\]\w\[\e[m\]$(__git_ps1 "\[\033[01;33m\] git(\[\e[35m\]%s\[\033[01;33m\])") \[\e[1;32m\]➜ \[\e[m\]'
#Current color scheme - Solarized
export CLICOLOR=1
export LSCOLORS=gxfxcxdxbxegedabagacad
export GREP_OPTIONS='--color=auto'
@dm-z
dm-z / gist:835152b06bac17ecfeaa
Created May 12, 2014 10:38
Save UIImage to disk
- (void)saveTestImage:(UIImage *)image
{
NSArray * paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString * basePath = ([paths count] > 0) ? [paths objectAtIndex:0] : nil;
NSData * binaryImageData = UIImagePNGRepresentation(image);
[binaryImageData writeToFile:[basePath stringByAppendingPathComponent:@"TestImage.png"] atomically:YES];
}
@dm-z
dm-z / Volume Mute
Created April 8, 2014 08:15
Mute/Unmute OS X system volume with AppleScript
set curVolume to get volume settings
if output muted of curVolume is false then
set volume with output muted
else
set volume without output muted
end if
@dm-z
dm-z / .gitignore
Last active August 29, 2015 13:56
gitignore for xCode/AppCode/Cocoapods
Build
build
DerivedData
.DS_Store
xcuserdata
*.xcworkspace
Podsld
*~
Pods
*.swp
@dm-z
dm-z / Volume Down
Last active January 3, 2016 11:09
Decrease OS X system volume with AppleScript (can be used in Alfred2 and QuickSilver to make hotkey and use it on non Apple keyboard to control volume)
set curVolume to output volume of (get volume settings)
-- work out the new setting
if curVolume > 6 then
set newVolume to curVolume - 6
else
-- can't go over 100
set newVolume to 0
end if
-- and apply it
set volume output volume newVolume
@dm-z
dm-z / Volume Up
Last active January 3, 2016 11:09
Increase OS X system volume with AppleScript (can be used in Alfred2 and QuickSilver to make hotkey and use it on non Apple keyboard to control volume)
set curVolume to output volume of (get volume settings)
-- work out the new setting
if curVolume < 94 then
set newVolume to curVolume + 6
else
-- can't go over 100
set newVolume to 100
end if
-- and apply it
set volume output volume newVolume
@dm-z
dm-z / HiddenFiles
Last active January 3, 2016 11:08
Show/Hide hidden files in OS X Finder
display dialog "Show Hidden Files..." & return & "Finder will relaunch!" buttons {"Show hidden files", "Hide hidden files", "Cancel"} default button 3 with title "Hidden files OS X helper"
copy the result as list to {buttonpressed}
try
if the buttonpressed is "Hide hidden files" then do shell script "defaults write com.apple.finder AppleShowAllFiles FALSE"
if the buttonpressed is "Show hidden files" then do shell script "defaults write com.apple.finder AppleShowAllFiles TRUE"
if the buttonpressed is "Cancel" then return
end try
do shell script ("killall Finder")