Skip to content

Instantly share code, notes, and snippets.

@YordiLorenzo
YordiLorenzo / Job.swift
Created October 31, 2019 07:30
Job Entity mapping in iOS
//
// Job.swift
// Temper
//
// Created by Said Rehouni on 24/07/2017.
// Copyright © 2017 Temper B.V. All rights reserved.
//
import CoreLocation
import ObjectMapper
open class GetJobService<T: Mappable>: BaseService<T, ErrorMappable> {
open var hashId: String
public init (hashId: String) {
self.hashId = hashId
}
open override var endpoint: String {
return "api/v1/contractor/jobs/" + hashId + "?include=open_shifts.contractor_match.contractor,open_shifts.contractor_match.shift,open_shifts.contractor_match.contractor_has_worked_before,open_shifts.contractor_match.tariff_incl_costs,open_shifts.contractor_match.actions,open_shifts.contractor_match.contractor_status,open_shifts.contractor_match.substituted_by,open_shifts.contractor_match.substituting_for,open_shifts.contractor_match.can_claim_cancellation_fee,work_shifts.contractor_match.contractor,work_shifts.contractor_match.shift,work_shifts.contractor_match.contractor_has_worked_before,work_shifts.contractor_match.tariff_incl_costs,work_shifts.contractor_match.actions,work_shifts.contractor_match.contractor_status,work_shifts.contractor_match.substituted_by,work_shifts.contractor_match.su
@YordiLorenzo
YordiLorenzo / filters.swift
Created September 21, 2019 09:43
Eureka example
self.form +++ Section("Filters")
<<< SwitchRow("sort_by_distance_tag"){
$0.value = User.sharedInstance.filters?.sortByDistance ?? false
$0.title = "Sorteer op afstand"
}.onChange({ row in
UserManager()
.updateFilters(cities: nil, sort_by_distance: row.value, distance: nil, completion: nil)
})
<<< StepperRow() {
@YordiLorenzo
YordiLorenzo / 0_reuse_code.js
Created February 3, 2017 10:21
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@YordiLorenzo
YordiLorenzo / psmodel.m
Last active August 29, 2015 14:23
Shows Guide Core Data snippet
- (BOOL) saveShow:(Show *)show {
if (! [self exists:show]) {
NSEntityDescription *entity = [NSEntityDescription entityForName:@"Show" inManagedObjectContext:self.managedObjectContext];
NSManagedObject *newShow = [[NSManagedObject alloc] initWithEntity:entity insertIntoManagedObjectContext:self.managedObjectContext];
NSError *error;
[newShow setValue:show.title forKey:@"title"];
[newShow setValue:[NSNumber numberWithLong:show.identifier] forKey:@"id"];
@YordiLorenzo
YordiLorenzo / UIAlertController+DKExtensions.m
Last active March 5, 2017 00:15
UIAlertController extension
#import "UIAlertController+DKExtensions.h"
@implementation UIAlertController (DKExtensions)
#define IPAD UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad
+ (UIAlertController *)alertWithTitle:(NSString *)title message:(NSString *)message
cancelButtonTitle:(NSString *)cancelButtonTitle cancelBlock:(void (^)())cancelBlock; {
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:title message:message preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:cancelButtonTitle style:UIAlertActionStyleCancel handler:cancelBlock];
@YordiLorenzo
YordiLorenzo / index.php
Created November 24, 2014 12:53
Portfolio - Hackathon 2013 Sample
/**
* Function to add Dijkstra edges to MediaCollege Amsterdam map
* This is the way we calculate which sector to reach from which sector
*/
function runTest() {
require("includes/config.inc.php");
require("includes/database.inc.php");
$g = new Graph();
@YordiLorenzo
YordiLorenzo / application.php
Created November 24, 2014 12:26
Portfolio - Art Explorer sample
/**
* Class for creating an Application
*/
<?php
require_once 'includes/config.inc.php';
require_once 'database.class.php';
class Application
{
private $APPLICATION_NAME;
private $APPLICATION_PUBLISH_DATE;
@YordiLorenzo
YordiLorenzo / GrowneController.php
Created November 24, 2014 10:48
Portfolio - Growne sample
/**
* Advanced GrowneController that uses SessionManager instances for managing a custom generated Session that is passed with an async call.
*/
<?php
use Growne\Handlers\GrowneHandler;
use Growne\Models\User;
use Growne\Models\Task;
use Growne\Models\Like;
use Growne\Models\Dislike;
@YordiLorenzo
YordiLorenzo / Facade.php
Created November 23, 2014 11:57
Portfolio - Simplos Home Automation
/**
* Responder Facade for returning a Facade accesor that can be used in the iOC container
*/
<?php namespace Simplos\Facades;
use Illuminate\Support\Facades\Facade;
class Responder extends Facade {
/**