Skip to content

Instantly share code, notes, and snippets.

View dev4dev's full-sized avatar
💭
Beep Boop Beep

Alex Antonyuk dev4dev

💭
Beep Boop Beep
View GitHub Profile
@dev4dev
dev4dev / swv.rb
Last active April 26, 2022 12:05
omzsh xcode verison
#!/usr/bin/env ruby
require 'open3'
# swift version
def swift_version(format = "Swift %{v}")
output, _, _ = Open3.capture3('swift --version')
match = output.split("\n").first.match('version (\d\.\d)')
@dev4dev
dev4dev / shit.js
Last active November 17, 2018 16:23
shit parser
const data = "https://res.cloudinary.com/indysigner/image/fetch/f_auto,q_auto/w_400/https://cloud.netlifyusercontent.com/assets/344dbf88-fdf9-42bb-adb4-46f01eedd629/1565855a-e53b-408b-b12f-b6f3115a8d84/3-accessible-presentations.jpg 400w,https://res.cloudinary.com/indysigner/image/fetch/f_auto,q_auto/w_800/https://cloud.netlifyusercontent.com/assets/344dbf88-fdf9-42bb-adb4-46f01eedd629/1565855a-e53b-408b-b12f-b6f3115a8d84/3-accessible-presentations.jpg 800w, https://res.cloudinary.com/indysigner/image/fetch/f_auto,q_auto/w_1200/https://cloud.netlifyusercontent.com/assets/344dbf88-fdf9-42bb-adb4-46f01eedd629/1565855a-e53b-408b-b12f-b6f3115a8d84/3-accessible-presentations.jpg 1200w, https://res.cloudinary.com/indysigner/image/fetch/f_auto,q_auto/w_1600/https://cloud.netlifyusercontent.com/assets/344dbf88-fdf9-42bb-adb4-46f01eedd629/1565855a-e53b-408b-b12f-b6f3115a8d84/3-accessible-presentations.jpg 1600w, https://res.cloudinary.com/indysigner/image/fetch/f_auto,q_auto/w_2000/https://cloud.netlifyusercontent.com
let a = "13"
let b = "13a"
if let a = Int(a), let b = Int(b) {
let result = a + b
print(result) // will print only if b is correct number
} else {
print("fuck you spilberg")
}
// some shared services
protocol NetworkService: class {
func get() -> Any
}
class TestnetworkService: NetworkService {
func get() -> Any {
return "GET IT"
}
}
@dev4dev
dev4dev / instruction.md
Last active March 4, 2016 11:10
ClangFormat

Clang Formatter

  1. Install Alcatraz
  2. Install ClangFormat Plugin ClangFormat
  3. Restart Xcode
  4. Download .clang-format.yml to your home directory
  curl -L -o ~/.clang-format https://gist.githubusercontent.com/dev4dev/78d0508304558e969b2a/raw/9bab5aefe2e29f4b7b6a5560642618e1e78b397c/.clang-format.yml
@dev4dev
dev4dev / .profile
Created November 10, 2014 18:45
Function for opening Xcode workspace/project
xc() {
WORKSPACE=$(ls -dt *.xcworkspace 2>/dev/null | head -n 1)
PROJECT=$(ls -dt *.xcodeproj 2>/dev/null | head -n 1)
if [[ $WORKSPACE != '' ]]; then
open $WORKSPACE
elif [[ $PROJECT != '' ]]; then
open $PROJECT
else
echo 'R U SROUS?'
fi
@dev4dev
dev4dev / deploy.rb
Created February 4, 2013 22:09
Builder auto deploy script
#!/usr/bin/env ruby -wKU
# encoding: UTF-8
def fail message
puts "ERROR: " + message
exit(-1)
end
def log message
stars = '*' * (message.length + 6)
@dev4dev
dev4dev / prob.cpp
Last active December 12, 2015 02:09
//
// main.cpp
// prob344
//
// Created by Alex Antonyuk on 2/1/13.
// Copyright (c) 2013 Alex Antonyuk. All rights reserved.
//
#include <iostream>
@dev4dev
dev4dev / gist:4656536
Created January 28, 2013 15:39
newgit shell command
function newgit() {
if [[ ! -d "$1" ]]; then
mkdir $1 && cd $_ && git init && touch README.md && git aa && git ci -m Initial
else
echo 'ERROR: such directory already exists.'
fi
}
@dev4dev
dev4dev / doc.md
Last active December 11, 2015 06:59
Git Rules

Git Configuration

Global ignore list

Проверить где у вас находится файл с глобальными правилами игнорирования можно коммандой

git config --global core.excludesfile

Если оказалось что у вас его нет, то выполняем следующие комманды:

cd ~