Get Homebrew installed on your mac if you don't already have it
Install highlight. "brew install highlight". (This brings down Lua and Boost as well)
#if TARGET_OS_IPHONE | |
#import <MobileCoreServices/MobileCoreServices.h> | |
#else | |
#import <CoreServices/CoreServices.h> | |
#endif | |
/* | |
MIME type to UTI | |
*/ | |
NSURLResponse *response = ... // assume a URL response from somewhere else. |
Get Homebrew installed on your mac if you don't already have it
Install highlight. "brew install highlight". (This brings down Lua and Boost as well)
i386 : iPhone Simulator | |
x86_64 : iPhone Simulator | |
arm64 : iPhone Simulator | |
iPhone1,1 : iPhone | |
iPhone1,2 : iPhone 3G | |
iPhone2,1 : iPhone 3GS | |
iPhone3,1 : iPhone 4 | |
iPhone3,2 : iPhone 4 GSM Rev A | |
iPhone3,3 : iPhone 4 CDMA | |
iPhone4,1 : iPhone 4S |
// See: http://kbokonseriousstuff.blogspot.fr/2013/04/making-functions-how-to-provide-simple.html?spref=tw | |
// From: http://coliru.stacked-crooked.com/view?id=665b6505b8cbe3631604d8300f9e6b27-50d9cfc8a1d350e7409e81e87c2653ba | |
#include <iostream> | |
#include <functional> | |
// Only takes std::functions | |
template<typename R, typename... P> | |
void do_something(std::function<R(P...)> &func) { | |
std::cout << &func << std::endl; |
/** | |
* FitCurves.js - Piecewise cubic fitting code | |
* | |
* original: FitCurves.c | |
* http://tog.acm.org/resources/GraphicsGems/gems/FitCurves.c | |
* | |
* ported by ynakajima (https://github.com/ynakajima). | |
* | |
* THIS SOURCE CODE IS PUBLIC DOMAIN, and | |
* is freely available to the entire computer graphics community |
(function () { | |
var makeCallback = function(eventType, observer) { | |
if (eventType === 'value') { | |
return function(snap) { | |
observer.onNext(snap); | |
}; | |
} else { | |
return function(snap, prevName) { | |
// Wrap into an object, since we can only pass one argument through. | |
observer.onNext({snapshot: snap, prevName: prevName}); |
Please consider using http://lygia.xyz instead of copy/pasting this functions. It expand suport for voronoi, voronoise, fbm, noise, worley, noise, derivatives and much more, through simple file dependencies. Take a look to https://github.com/patriciogonzalezvivo/lygia/tree/main/generative
float rand(float n){return fract(sin(n) * 43758.5453123);}
float noise(float p){
float fl = floor(p);
float fc = fract(p);
// Create CustomView.xib, set File's Owner to CustomView. | |
// Link the top level view in the XIB to the contentView outlet. | |
class CustomView : UIView { | |
@IBOutlet private var contentView:UIView? | |
// other outlets | |
override init(frame: CGRect) { // for using CustomView in code | |
super.init(frame: frame) | |
self.commonInit() |
// Usage | |
let argv = CStringArray(["ls", "/"]) | |
posix_spawnp(nil, argv.pointers[0], nil, nil, argv.pointers, nil) | |
// Is this really the best way to extend the lifetime of C-style strings? The lifetime | |
// of those passed to the String.withCString closure are only guaranteed valid during | |
// that call. Tried cheating this by returning the same C string from the closure but it | |
// gets dealloc'd almost immediately after the closure returns. This isn't terrible when | |
// dealing with a small number of constant C strings since you can nest closures. But |