Skip to content

Instantly share code, notes, and snippets.

@kevinSuttle
kevinSuttle / meta-tags.md
Last active November 7, 2024 10:05 — forked from lancejpollard/meta-tags.md
List of Usable HTML Meta and Link Tags
@gavinb
gavinb / clutils.c
Created June 7, 2013 12:26
Convert an OpenCL cl_error code into a string.
/*
OpenCL Utility functions
*/
#ifndef CLUTILS_H_INC
#define CLUTILS_H_INC
#include <OpenCL/cl.h>
const char* clErrorString(cl_int err);
@GaryUnbounce
GaryUnbounce / FullBackgorund
Created February 18, 2014 22:41
Make a background image scale the full page
<style type="text/css">
#lp-pom-root {
-webkit-background-size: cover !important;
-moz-background-size: cover !important;
-o-background-size: cover !important;
background-size: cover !important;
}
</style>
import Darwin
let isLittleEndian = Int(OSHostByteOrder()) == OSLittleEndian
let htons = isLittleEndian ? _OSSwapInt16 : { $0 }
let htonl = isLittleEndian ? _OSSwapInt32 : { $0 }
let htonll = isLittleEndian ? _OSSwapInt64 : { $0 }
let ntohs = isLittleEndian ? _OSSwapInt16 : { $0 }
let ntohl = isLittleEndian ? _OSSwapInt32 : { $0 }
let ntohll = isLittleEndian ? _OSSwapInt64 : { $0 }
@xmzio
xmzio / Macros.swift
Last active October 21, 2019 07:31
My aLog and dLog macros in Swift (to abbreviate NSLog)
//
// Macros.swift
//
// Created by Xavier Muñiz on 6/12/14.
import Foundation
// dLog and aLog macros to abbreviate NSLog.
// Use like this:
@MartinJNash
MartinJNash / CustomNSViewIBDesignable.swift
Last active May 2, 2018 21:32
Xcode Snippets - NSView & UIView IBDesignable
import Cocoa
@IBDesignable
class <#ClassName#> : NSView {
override init(frame frameRect: NSRect) {
super.init(frame: frameRect)
commonSetup()
}
@phatmann
phatmann / BackgroundTask.swift
Created April 15, 2015 03:14
Encapsulate iOS background tasks in a Swift class
class BackgroundTask {
private let application: UIApplication
private var identifier = UIBackgroundTaskInvalid
init(application: UIApplication) {
self.application = application
}
class func run(application: UIApplication, handler: (BackgroundTask) -> ()) {
// NOTE: The handler must call end() when it is done
@mackuba
mackuba / wwdc15.md
Last active August 6, 2022 17:28
New stuff from WWDC 2015

Here's my own list of the interesting stuff announced during this year's WWDC, collected from the keynotes, various Apple docs, blog posts and tweets.

If you're planning to watch the videos, I really recommend this Mac app that helps you download and watch them: https://github.com/insidegui/WWDC.

OS X El Capitan

http://www.apple.com/osx/elcapitan-preview/

  • split view - two apps side by side on full screen
@patoi
patoi / SwiftStateMachine.swift
Last active April 30, 2021 05:06
Swift State machine
//: # State machine: handling three state and transition
import GameplayKit
class RetrievingDataState: GKState {
override func isValidNextState(stateClass: AnyClass) -> Bool {
print("\n---> \(stateClass) class")
return (stateClass == DataAvailableState.self) || (stateClass == DataNotAvailableState.self)
}