Skip to content

Instantly share code, notes, and snippets.

@daltheman
daltheman / QSQlite3
Last active February 9, 2020 20:16
Simple SQLite3 Wrapper written in Swift
//
// QSQLite3.swift
// SQLiteWrapper
//
// Created by Danilo Altheman on 24/06/15.
// Copyright © 2015 Quaddro - Danilo Altheman. All rights reserved.
/* Usage:
// Open or create a Database
let database = QSQLite3(path: NSHomeDirectory() + "/Documents/database.sqlite")
@steipete
steipete / PSPDFHigherOrderFunctions.hpp
Last active May 16, 2020 02:50
A C++ smart pointer for CoreFoundation objects
// hpp:
/// A smart pointer that can manage the lifecycle of Core Foundation objects.
template<typename T>
class CFPointer {
public:
CFPointer() : storage(nullptr) { }
CFPointer(T pointer) : storage(toStorageType(pointer)) {
if (storage) {
@Tokuriku
Tokuriku / Count lines of code in Xcode project
Last active March 9, 2023 23:16 — forked from ccabanero/Count lines of code in Xcode project
Count lines of code in SWIFT Xcode project
1. Open Terminal
2. cd to your Xcode project
3. Execute the following when inside your target project:
find . -name "*.swift" -print0 | xargs -0 wc -l
@chriseidhof
chriseidhof / LICENSE
Last active July 16, 2019 13:14
A tiny networking library
Copyright 2015 Chris Eidhof
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHE
// Restify Server CheatSheet.
// More about the API: http://mcavage.me/node-restify/#server-api
// Install restify with npm install restify
// 1.1. Creating a Server.
// http://mcavage.me/node-restify/#Creating-a-Server
var restify = require('restify');
struct InputStreamGenerator : Generator {
var inputStream : NSInputStream
var chunkSize : Int
init(inputStream : NSInputStream, chunkSize : Int) {
self.inputStream = inputStream
self.chunkSize = chunkSize
}
@Andrewjp97
Andrewjp97 / SKScene+DeterminingTouches.h
Created November 25, 2013 20:46
This Objective-C Class Category on SKScene returns a Boolean value for whether a touch occurred within a specified Boundary
//
// SKScene+DeterminingTouches.h
// Space Platypus
//
// Created by Andrew Paterson on 11/25/13.
// Copyright (c) 2013 Andrew Paterson. All rights reserved.
//
#import <SpriteKit/SpriteKit.h>
@steipete
steipete / UIKitLegacyDetector.m
Last active March 12, 2024 13:57
A simple way to detect at runtime if we're running in UIKit legacy mode or the new "flat" variant. Written for our PDF iOS SDK (http://pspdfkit.com), where the precompiled binary needs to detect at runtime in what variant it's running. Want more stuff like that? Follow me on Twitter: http://twitter.com/steipete
// Taken from http://PSPDFKit.com. This snippet is under public domain.
#define UIKitVersionNumber_iOS_7_0 0xB57
BOOL PSPDFIsUIKitFlatMode(void) {
static BOOL isUIKitFlatMode = NO;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
// We get the modern UIKit if system is running >= iOS 7 and we were linked with >= SDK 7.
if (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber_iOS_7_0) {
isUIKitFlatMode = (NSVersionOfLinkTimeLibrary("UIKit") >> 16) >= UIKitVersionNumber_iOS_7_0;
}
@tskaggs
tskaggs / OSX-Convert-MOV-GIF.md
Last active October 9, 2023 12:15
Creating GIFs from .MOV files in OSX using FFmpeg and ImageMagick

Convert MOV to GIF using FFmpeg and ImageMagick

I tried a few different techniques to make a GIF via command-line and the following gives me the best control of quality and size. Once you're all setup, you'll be pumping out GIFs in no time!

Preparation

Install FFmpeg

  • $ brew install ffmpeg [all your options]
    • Example: $ brew install ffmpeg --with-fdk-aac --with-ffplay --with-freetype --with-frei0r --with-libass --with-libvo-aacenc --with-libvorbis --with-libvpx --with-opencore-amr --with-openjpeg --with-opus --with-rtmpdump --with-schroedinger --with-speex --with-theora --with-tools

Install ImageMagick

@stevederico
stevederico / gist:5316737
Last active December 15, 2015 20:09
How to Add AFIncrementalStore to an Existing Project

How to Add AFIncrementalStore to an Existing Project

Add dependencies without Cocoapods

  • Add Core Data
  • Add Mobile Core Services
  • Add System Configuration
  • Add AFIncrementalStore
  • Add AFNetworking
  • Add InflectorKit