Skip to content

Instantly share code, notes, and snippets.

View skyebook's full-sized avatar

Skye Book skyebook

View GitHub Profile
https://github.com/nvidia/nvidia-docker/wiki/Installation-(version-2.0)
ubuntu desktop 18.04 w/ minimal install
@skyebook
skyebook / CVPixelBufferPixelFormatNames.swift
Created March 24, 2017 15:26
Easily get the pixel format name of a CVPixelBuffer
public func CVPixelBufferGetPixelFormatName(pixelBuffer: CVPixelBuffer) -> String {
let p = CVPixelBufferGetPixelFormatType(pixelBuffer)
switch p {
case kCVPixelFormatType_1Monochrome: return "kCVPixelFormatType_1Monochrome"
case kCVPixelFormatType_2Indexed: return "kCVPixelFormatType_2Indexed"
case kCVPixelFormatType_4Indexed: return "kCVPixelFormatType_4Indexed"
case kCVPixelFormatType_8Indexed: return "kCVPixelFormatType_8Indexed"
case kCVPixelFormatType_1IndexedGray_WhiteIsZero: return "kCVPixelFormatType_1IndexedGray_WhiteIsZero"
case kCVPixelFormatType_2IndexedGray_WhiteIsZero: return "kCVPixelFormatType_2IndexedGray_WhiteIsZero"
case kCVPixelFormatType_4IndexedGray_WhiteIsZero: return "kCVPixelFormatType_4IndexedGray_WhiteIsZero"

Keybase proof

I hereby claim:

  • I am skyebook on github.
  • I am sbook (https://keybase.io/sbook) on keybase.
  • I have a public key ASB9pH5ppMwX5I_fKyUwX31eddw5yrLUwALDA44PUH-gGAo

To claim this, I am signing this object:

@skyebook
skyebook / lock.css
Created March 15, 2017 20:03 — forked from visnup/lock.css
"lock" orientation of a website for mobile (iPad, iPhone)
/* if portrait mode is detected, rotate the entire site -90 degrees to hint rotating to landscape */
@media (orientation: portrait) {
body {
-webkit-transform: rotate(-90deg);
-moz-transform: rotate(-90deg);
-o-transform: rotate(-90deg);
-ms-transform: rotate(-90deg);
transform: rotate(-90deg);
}
}
extension Array {
func objectsAtIndexPaths(indexPaths: [NSIndexPath]) -> [Element] {
return indexPaths.map {self[$0.row]}
}
}
@skyebook
skyebook / swoon.swift
Created May 13, 2016 17:12
I love array functions.
@objc private func filterSelected(filterButton: FilterSelectButton) {
orderedButtons.filter{return $0 != filterButton}.forEach{$0.selected = false}
}
@skyebook
skyebook / every.swift
Last active February 22, 2016 16:06
Javascript has the really nice 'every', while we do this in swift. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every
// Is every point in this rectangle? This would be easy in JS.
let containsAllPoints = points.reduce(true) { return !$0 ? $0 : CGRectContainsPoint(rect, $1)}
@skyebook
skyebook / ListUtils.java
Created August 11, 2015 21:02
Clamped subList
package donald.trump.for.president;
import java.util.List;
public class ListUtils {
/**
* Return a list containing, at most, the number of requested objects. If
* there are less than <code>count</code> items present, all items in the
* list are returned.
@skyebook
skyebook / ExportWindow.mel
Last active August 29, 2015 14:19
Betaville Batch Exporter for Maya
-title "RE-Export building .DAE"
-widthHeight 100 100;
rowLayout -numberOfColumns 2;
columnLayout -adjustableColumn true;
button -label "A-------MoveTool-----------------"
-command
MoveTool;
EnterEditMode;
ctxEditMode;
button -label "B-------CenterPivot-------------"
@skyebook
skyebook / UnfuckedButton.m
Created February 1, 2015 01:03
Put titleLabel under UIButtton imageView
- (CGRect)titleRectForContentRect:(CGRect)contentRect
{
// Can't reference titleLabel directly in here, so get the frame by calling into the UIButton implementation
CGRect defaultTitleFrame = [super titleRectForContentRect:contentRect];
CGSize titleSize = defaultTitleFrame.size;
CGPoint imageCenter = self.imageView.center;
return CGRectMake(imageCenter.x - (titleSize.width/2), imageCenter.y+titleSize.height, titleSize.width, titleSize.height);
}