Skip to content

Instantly share code, notes, and snippets.

@jensmeder
jensmeder / QR Code with Core Image (Playground).swift
Created May 20, 2017 10:15
Generating QR Codes with Core Image
import Foundation
import UIKit
import PlaygroundSupport
let data = "Hello World!".data(using: .utf8)!
let filter = CIFilter(name: "CIQRCodeGenerator", withInputParameters: ["inputMessage" : data, "inputCorrectionLevel":"L"])
let image = filter!.outputImage!
let img = UIImage(ciImage: image)
PlaygroundPage.current.liveView = UIImageView(image: img)
@jensmeder
jensmeder / Scaled QR Code with Core Image (Playground).swift
Created May 20, 2017 10:15
Generating QR Codes with Core Image
import Foundation
import UIKit
import PlaygroundSupport
let data = "Hello World!".data(using: .utf8)!
let filter = CIFilter(name: "CIQRCodeGenerator", withInputParameters: ["inputMessage" : data, "inputCorrectionLevel":"L"])
let ciimage = filter!.outputImage!
let transform = CGAffineTransform(scaleX: 7.0, y: 7.0)
let image = ciimage.applying(transform)
let img = UIImage(ciImage: image)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.developer.nfc.readersession.formats</key>
<array>
<string>NDEF</string>
</array>
</dict>
</plist>
import UIKit
import CoreNFC
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate, NFCNDEFReaderSessionDelegate {
var window: UIWindow?
var session: NFCNDEFReaderSession?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
@jensmeder
jensmeder / AppDelegate.swift
Created June 13, 2017 09:28
rdar://32734461 (Xcode 9 beta1: Swift generics in custom class crashes Instruments when specifying Dictionary type)
//
// AppDelegate.swift
// Crashy
//
// Created by Jens Meder on 13.06.17.
// Copyright © 2017 Jens Meder. All rights reserved.
//
import UIKit
@jensmeder
jensmeder / Photos.java
Last active November 11, 2019 18:27
Medium
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardCopyOption;
import java.util.Map;
import java.util.List;
public class Photos {
private final Path source;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardCopyOption;
import java.util.Map;
import java.util.List;
public class Photos {
private final Path source;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardCopyOption;
import java.util.Map;
import java.util.List;
public class Photos {
private final Path source;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardCopyOption;
import java.util.Map;
import java.util.List;
public class Photos {
private final Path source;
@jensmeder
jensmeder / Dockerfile
Last active March 23, 2024 21:13
Dockerfile for running x86 applications with Wine in Alpine Docker Containers
FROM i386/alpine:3.10.2
# Wine 32Bit for running EXE
RUN apk add --no-cache wine=3.0.4-r1 freetype=2.10.0-r0
# Configure Wine
RUN winecfg
# Install wget
RUN apk add --no-cache wget=1.20.3-r0