This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static func mergeBlocks(base: [String: Any], replacement: [String: Any]) -> [String: Any] { | |
var result = base.merging(replacement) { $1 } | |
for key in base.keys { | |
guard let val = base[key] else { continue } | |
guard let json = val as? [String: Any], | |
let replacement = replacement[key] as? [String: Any] else { | |
continue | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import PlaygroundSupport | |
PlaygroundPage.current.needsIndefiniteExecution = true | |
// Taken from https://www.avanderlee.com/swift/asynchronous-operations/ | |
class AsyncOperation: Operation { | |
private let lockQueue = DispatchQueue(label: "com.leopicado.asyncop", attributes: .concurrent) | |
override var isAsynchronous: Bool { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protocol MyProtocol { | |
func requiredMethod() -> Void | |
func optionalMethod() -> Void | |
} | |
extension MyProtocol { | |
func optionalMethod() -> Void {} // Default implementation | |
} | |
struct AStructThatConformsToMyProtocol:MyProtocol { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import UIKit | |
import Combine | |
var texto = CurrentValueSubject<String, Never>("hola buen chico") | |
let sub = texto | |
.map { $0.boyeSpeakify } | |
.handleEvents(receiveOutput: { UIPasteboard.general.string = $0 }) | |
.sink { print($0) } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum HttpServiceError: Error { | |
case uno | |
case dos | |
} | |
struct HttpService { | |
func call() -> throws {} | |
} | |
enum FirmwareServiceError: Error { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const lib = require('../../lib/index'); | |
describe('Basic functionality', function () { | |
it('displays the help banner when no params are given', function () { | |
lib({}) | |
.then(result => expect(result).toContain('Usage: makeappicon --base-icon ICON_PATH')) | |
.catch(); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
// Module dependencies | |
var _ = require('lodash'), | |
fs = require('fs'), | |
gm = require('gm'), | |
path = require('path'); | |
// Global variables | |
var EXECUTION_PATH = process.cwd() + path.sep, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── | |
--- a/src/sample.spec.ts | |
+++ b/src/sample.spec.ts | |
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── | |
@@ -1,5 +1,6 @@ | |
import { TestBed, inject, async } from '@angular/core/testing'; | |
import { TestBed, inject, async, fakeAsync, tick } from '@angular/core/testing'; | |
import { SampleModule, SampleService } from "./"; | |
describe('SampleTest', () => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
// @escape VS @no-escaping | |
class Uno { | |
func closure(completion: () -> Void) { | |
// Non-escaping | |
completion() | |
// Escaping | |
// DispatchQueue.main.asyncAfter(deadline: .now() + 5, execute: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.app.Activity; | |
import android.app.Application; | |
import android.content.Context; | |
import android.os.Bundle; | |
import android.os.Handler; | |
import android.util.Log; | |
import java.util.List; | |
import java.util.concurrent.CopyOnWriteArrayList; |
NewerOlder