Skip to content

Instantly share code, notes, and snippets.

View klaas's full-sized avatar
🤠
Howdy!

Klaas klaas

🤠
Howdy!
View GitHub Profile
@OdNairy
OdNairy / main.m
Last active December 21, 2015 00:28
// Source: https://devforums.apple.com/message/866487#866487
typedef int (*PYStdWriter)(void *, const char *, int);
static PYStdWriter _oldStdWrite;
int __pyStderrWrite(void *inFD, const char *buffer, int size)
{
if ( strncmp(buffer, "AssertMacros: queueEntry", 24) == 0 ) {
return 0;
@letiemble
letiemble / openssl-maker.sh
Last active April 23, 2023 11:33
A bash script to generate "all-in-one" OpenSSL static libraries for OS X and iOS. The script produces fat static libraries (i386, x86_64 for OS X) and (i386, x86_64, armv7, armv7s, arm64 for iOS) suitable for integration in both OS X and iOS project.
#!/bin/bash
###############################################################################
## ##
## Build and package OpenSSL static libraries for OSX/iOS ##
## ##
## This script is in the public domain. ##
## Creator : Laurent Etiemble ##
## ##
###############################################################################
@jokertarot
jokertarot / clfontpng.cc
Created November 21, 2013 15:43
How to render color emoji font with FreeType 2.5
// = Requirements: freetype 2.5, libpng, libicu, libz, libzip2
// = How to compile:
// % export CXXFLAGS=`pkg-config --cflags freetype2 libpng`
// % export LDFLAGS=`pkg-config --libs freetype2 libpng`
// % clang++ -o clfontpng -static $(CXXFLAGS) clfontpng.cc $(LDFLAGS) \
// -licuuc -lz -lbz2
#include <cassert>
#include <cctype>
#include <iostream>
#include <memory>
@Inferis
Inferis / ViewController.swift
Last active December 1, 2019 23:27
Beginnings of a GCD wrapper in swift
import UIKit
import QuartzCore
class ViewController: UIViewController {
@IBOutlet weak var label: UILabel
@IBOutlet weak var counter: UILabel
override func viewDidLoad() {
super.viewDidLoad()
import Foundation
let argumentCount = Int(C_ARGC)
var argumentArray: Array<String> = Array<String>()
for index in 0..argumentCount {
argumentArray.append(String.fromCString(C_ARGV[index]))
}
@frozzare
frozzare / array.swift
Created June 8, 2014 18:43
Example how to extend array type in Swift
import Foundation
extension Array {
/**
* Get first item in array.
*
* @return First item in array.
*/
@jpsim
jpsim / SwiftClassParsing.playground
Last active December 8, 2021 22:23
Swift and Objective-C Class Parsing
////////////////////////////////////////////////
//
// Swift and Objective-C Class Parsing
//
////////////////////////////////////////////////
import Foundation
// Class parsing
@erica
erica / gist:06d7e44f4f834757dc36
Last active April 21, 2023 17:14
Exploring
//
// explore.swift
// CmdLineTest
//
// Created by Erica Sadun on 6/25/14.
// Copyright (c) 2014 Erica Sadun. All rights reserved.
//
import Foundation
@mchambers
mchambers / serializer.swift
Created June 25, 2014 07:49
A simple, limited model-to-JSON serializer in Swift.
// Here we'll use Swift's IDE-supporting reflect()
// function to build a basic JSON serializer.
// Per the fine engineers at WWDC, Swift's reflection support
// exists purely to support the IDE and the Playground. But
// we can have some fun with it anyway. ;)
class SerializerBase {
}
@hooman
hooman / AssociatedObjects.swift
Last active May 4, 2022 07:33
Take 2.0: A completely new take on Objective-C associated types. (See history for the ancient approach)
// Playground - noun: a place where people can play
//
//
// By: Hooman Mehr (hooman@mac.com)
// Gist: https://gist.github.com/hooman/599e381d5f037b87d20b (The latest version is always here)
//
//
// Update: 07/30/2014
// Added WeaklyOwned & removeOrphans for memory management support, added more generics & basic access control.
// 08/06/2014