Skip to content

Instantly share code, notes, and snippets.

View nakiostudio's full-sized avatar
⚛️

Carlos Vidal nakiostudio

⚛️
View GitHub Profile
- (void)reloadAnimated:(BOOL)animated withCompletionBlock:(void(^)())completionBlock
{
FWTPieChartLayer *pieLayer = self.containerLayer.sublayers.firstObject;
[CATransaction begin];
[CATransaction setCompletionBlock:completionBlock];
[CATransaction setDisableActions:YES];
CABasicAnimation *animation = (CABasicAnimation *)[pieLayer actionForKey:@"animationCompletionPercent"];
animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
@nakiostudio
nakiostudio / UpdateRealmObject.swift
Last active June 25, 2019 14:04
Make RealmSwift write and update an Object keeping the existing relationships
/**
Writes a set of objects in the database.
- parameter objects: Array of `Objects` to be stored on the database
- parameter configuration: Realm `Configuration` in which the write action will be performed
- parameter update: Enabled the custom *update* maintaining existing relationships
*/
static func write(objects : [Object], configuration: Realm.Configuration, update: Bool = false) {
if let realm = try? Realm(configuration: configuration) {
realm.beginWrite()
@nakiostudio
nakiostudio / Rakefile
Last active May 17, 2016 08:13
Easily customisable Rake task to send APNS push notifications
require "rake"
require "houston"
namespace :push do
# Enables console logging
STDOUT.sync = true
# Instructions
# $> sudo gem install rake
// EasyPeasy
view.easy.layout(Edges(10.0))
// SnapKit
view.snp.makeConstraints { (make) -> Void in
make.edges.equalTo(superview).inset(UIEdgeInsetsMake(10.0, 10.0, 10.0, 10.0))
}
// Cartography
constrain(view) { view in
button.easy.layout(
CenterX(0.0),
CenterY(0.0),
Width(160.0),
Height(50.0)
)
button.easy.layout(
Center(0.0),
Size(CGSize(width: 160.0, height: 50.0))
)
button.easy.layout(
Bottom(20.0)
)
button.easy.layout(Bottom(20.0))
button.easy.layout(Bottom(20.0))
button.superview?.layoutIfNeeded()
button.easy.layout(Width(200.0))
button.layoutIfNeeded()