Skip to content

Instantly share code, notes, and snippets.

View mgrebenets's full-sized avatar
🐢

Maksym Grebenets mgrebenets

🐢
View GitHub Profile
@mgrebenets
mgrebenets / Sample.m
Last active November 10, 2015 11:43
Objective-C Code Formatting Sample
//
// Copyright blah-blah
//
// ---
// Group of assignments
int x = 5;
int longVariableName = 444;
unsigned long long anotherVar = 3;
@mgrebenets
mgrebenets / block-call-vs-yeild.rb
Created January 20, 2016 06:15
Use of block.call vs yield
def platform_call(platform_name, &block)
puts "SupportedPlatforms.verify!(platform_name)"
puts "self.current_platform = platform_name"
block.call
puts "self.current_platform = nil"
end
def platform_yield(platform_name, &block)
@mgrebenets
mgrebenets / __MAGIKCRAFT__.mgrebenets.magikcraft_spells.md
Last active August 15, 2017 10:56
Magikcraft Spells, by mgrebenets.
@mgrebenets
mgrebenets / __MAGIKCRAFT__.mgrebenets.package_json.md
Created August 15, 2017 09:34
Magikcraft API: package_json files, by mgrebenets.
@mgrebenets
mgrebenets / DangerousFloats.m
Last active August 25, 2017 05:16
Dangerous Floats
@implementation Floats
static inline BOOL fequal(double a, double b) {
return (fabs(a - b) < FLT_EPSILON || fabs(a - b) < FLT_MIN);
}
+ (void)test {
CGFloat x = NSNotFound;
NSLog(@"%f = %ld", x, (long)NSNotFound);
@mgrebenets
mgrebenets / Cartfile.rb
Created March 2, 2018 03:48
SwiftScriptRunner
github "alamofire/Alamofire" ~> 4.6.0
@mgrebenets
mgrebenets / Example.swift
Created March 10, 2018 10:53
Async Swift Scripting - 1
import Alamofire
Alamofire.request("http://httpbin.org/get")
.responseJSON { response in
print(response) // Result of response serialization
}
print("Done")
@mgrebenets
mgrebenets / Podfile
Created March 10, 2018 10:55
Async Swift Scripting - 2
platform :osx, "10.10"
use_frameworks!
plugin "cocoapods-rome"
target :dummy do
pod "Alamofire", "~> 4.6.0"
end
post_install do |installer|
swift_version = `cat .swift-version`.strip
@mgrebenets
mgrebenets / pod_install.sh
Created March 10, 2018 10:57
Async Swift Scripting - 3
# Build the frameworks
pod install
@mgrebenets
mgrebenets / Cartfile
Created March 10, 2018 10:58
Async Swift Scripting - 4
github "alamofire/Alamofire" ~> 4.6.0