This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Accelerate/Accelerate.h> | |
static double vsum(const double *vector, size_t length) { | |
double *const ones = (double *)malloc(sizeof(double) * length); | |
const double one = 1; | |
vDSP_vfillD(&one, ones, 1, length); | |
double sum = 0; | |
vDSP_dotprD(ones, 1, vector, 1, &sum, length); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// AppDelegate.m | |
// MetalComputeOSX | |
// | |
#import "AppDelegate.h" | |
@import Metal; | |
#define IMAGE_SIZE 128 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// BlurredImageGenerator.swift | |
// | |
// Copyright (c) 2015 Matt Rajca. All rights reserved. | |
// | |
import UIKit | |
func generateBlurredImageFromImage(image: UIImage) -> UIImage { | |
let sourceImageRect = CGRectMake(0, 0, image.size.width, image.size.height) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Playground - noun: a place where people can play | |
let array = [3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5, 8, 9, 7, 9, 3, 2, 8, 4, 6, 2, 7] | |
// Computes the length of the longest increasing subsequence in the list of integers. | |
func lis(list: [Int]) -> Int { | |
return lis(0, list, nil) | |
} | |
func lis(index: Int, list: [Int], largestValue: Int?) -> Int { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// main.c | |
// | |
// Copyright (c) 2014 Matt Rajca. All rights reserved. | |
// | |
#include <stdio.h> | |
#include <dispatch/dispatch.h> | |
#include <libkern/OSAtomic.h> | |
#include <sched.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// NSUserDefaults+Subscripting.h | |
// | |
// Created by Matt on 9/2/13. | |
// Copyright (c) 2013 Matt Rajca. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> | |
/* keys must be NSStrings */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var acorn = [JSTalk application:"Acorn"]; | |
var w = 640; | |
var h = 960; | |
var stripeW = 20; | |
var spaceW = 20; | |
var foregroundColor = [NSColor redColor]; | |
var backgroundColor = [NSColor blueColor]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// imp.m | |
// imp | |
// | |
// Copyright (c) 2012 Matt Rajca. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> | |
#import <objc/runtime.h> |