Skip to content

Instantly share code, notes, and snippets.

View lukaskollmer's full-sized avatar
👻
procrastinating

Lukas Kollmer lukaskollmer

👻
procrastinating
View GitHub Profile
@lukaskollmer
lukaskollmer / block.cc
Created May 16, 2017 18:26
Objective-C blocks in C++ (this actually works!)
int __block_invoke_1(struct __block_literal_1 *_block, ...) {
printf("hello world\n");
return 1;
}
struct __block_literal_1 {
void *isa;
int flags;
int reserved;
//int (*invoke)(struct __block_literal_1 *, ...);
//
// PSPDFFastEnumeration.h
// PSPDFFoundation
//
// PSPDFKit is the leading cross-platform solution for integrating PDFs into your apps: https://pspdfkit.com.
// Try it today using our free PDF Viewer app: https://pdfviewer.io/
//
// This file is MIT licensed.
@protocol PSPDFFastEnumeration <NSFastEnumeration>
@JadenGeller
JadenGeller / Cluster.swift
Created March 13, 2017 01:27
Class Cluster
class Number /* class cluser */ {
class Int8: Number {
var value: Swift.Int8
init(_ value: Swift.Int8) { self.value = value }
}
class Int: Number {
var value: Swift.Int
init(_ value: Swift.Int) { self.value = value }
}
@rajadain
rajadain / github-hasklig-fira-code-style.css
Last active February 6, 2019 19:43
Hasklig / Fira Code on GitHub Stylish CSS
@-moz-document domain("github.com"), domain("gist.github.com"), domain("render.githubusercontent.com") {
/* Hasklig https://github.com/i-tu/Hasklig */
/* Fira Code https://github.com/tonsky/FiraCode */
/* Ligaturizer https://github.com/ToxicFrog/Ligaturizer */
.branch-name,
.blob-num,
.blob-code-inner,
.CodeMirror pre,
.commit .sha,
.commit-desc pre,
anonymous
anonymous / 0ui.js
Created January 29, 2017 16:59
const ui = require("ui");
class MyView extends ui.View {
constructor() {
super()
//
@omarshahine
omarshahine / CheckAppleStock
Last active January 15, 2017 18:51
Checks Apple inventory for availability of any Apple SKU. In this example, AirPods
# If you don't have the requests module, you can download by typing:
#
# sudo easy_install -U requests
#
# into the terminal on macOS
#
# You can change the partnum below with any Apple SKU
#
import urllib
@steventroughtonsmith
steventroughtonsmith / gist:62f0b14d5ef532a4be2e2529187c100d
Created November 18, 2016 17:28
iOS Simulator fullscreen enabler
call ((NSWindow *)[(NSArray *)[[NSApplication sharedApplication] windows] lastObject]).collectionBehavior = 1<<7|1<<8|1<<11

Using Swift Package Manager with iOS

Step 1:

File > New > Project...

Step 2:

Create a Package.swift file in your root project directory, add dependencies, then run swift package fetch on the command line in the same directory. We’re not going to run swift build because it will just complain.

@dgelessus
dgelessus / pythonista_startup.py
Created August 10, 2016 16:47
pythonista_startup.py with enable_faulthandler
# This is an example pythonista_startup.py script.
# The code below is from https://github.com/dgelessus/pythonista_startup/blob/master/enable_faulthandler.py
from __future__ import absolute_import, division, print_function
def enable_faulthandler():
import ctypes
import datetime
import errno
import io
@AngeloStavrow
AngeloStavrow / CalculatingHumidex.playground
Last active September 17, 2016 15:05
Playing with Swift 3's Units and Measurements to calculate humidex values.
import Foundation
// The air temperature in degrees Celsius.
var airTemperature = Measurement(value: 29.74, unit: UnitTemperature.celsius)
// The dewpoint temperature in degrees Celsius.
var dewpoint = Measurement(value: 19.08, unit: UnitTemperature.celsius)
// Calculate the humidex value.
let humidex = airTemperature.value + 0.5555 * ((6.11 * exp(5417.7530 * ((1/273.16) - (1/dewpoint.converted(to: UnitTemperature.kelvin).value)))) - 10)