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
# creates a sparsebundle disk image with a 128MB band size | |
MACHINE_NAME=your-machine-name | |
echo $MACHINE_NAME | |
hdiutil create -size 900g -type SPARSEBUNDLE -nospotlight -volname "Backup of $MACHINE_NAME" -fs "Case-sensitive Journaled HFS+" -imagekey sparse-band-size=262144 -verbose ./$MACHINE_NAME.sparsebundle |
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
# find out how big the sparse-band-size is in a mounted volume | |
hdiutil info -verbose | grep band-size | |
# default Time Machine sparsbundle virtual-band-size = 16384 (8MB) | |
# create-sparsebundle's virtual-band-size = 262144 (128MB) |
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
# -------------------- | |
# Clang configuration. | |
# -------------------- | |
using clang : osx | |
: xcrun clang -arch i386 -arch x86_64 -stdlib=libc++ -std=c++11 | |
; | |
using clang : ios | |
: xcrun clang -arch armv7 -arch armv7s -stdlib=libc++ -std=c++11 -miphoneos-version-min=5.0 -isysroot |
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
// -*- compile-command: "clang++ -std=gnu++0x -stdlib=libc++ -o remove_if remove_if.cpp" -*- | |
#include <iostream> | |
#include <vector> | |
using std::cout; | |
using std::endl; | |
int main (int, char **) { | |
std::vector<int> ints = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; | |
cout << "Range-based for loop:" << endl; |
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
python -m SimpleHTTPServer 8080 |
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
// debounce a callback function with delay being the longest acceptable time before seeing an effect | |
function debounce (fn, delay) { | |
var timeout = null; | |
return function () { | |
if( timeout !== null ){ clearTimeout( timeout ); } | |
timeout = setTimeout( fn, delay ); | |
} | |
} | |
// example use: |
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 "cinder/app/AppNative.h" | |
#include "cinder/gl/gl.h" | |
#include "cinder/Timeline.h" | |
#include "cinder/Rand.h" | |
#import <UIKit/UIView.h> | |
#import <UIKit/UIApplication.h> | |
using namespace ci; | |
using namespace ci::app; | |
using namespace std; |
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
// In your .h file: | |
#ifdef __OBJC__ | |
@class ImplementationClass; | |
#else | |
class ImplementationClass; | |
#endif | |
class Facade | |
{ | |
public: |
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
#! /usr/bin/python | |
# Server config: http://stackoverflow.com/questions/4139170/bind-httserver-to-local-ipport-so-that-others-in-lan-can-see-it | |
# IP address: http://stackoverflow.com/questions/166506/finding-local-ip-addresses-using-pythons-stdlib | |
import socket | |
import BaseHTTPServer | |
from SimpleHTTPServer import SimpleHTTPRequestHandler | |
# Announce the IP address and port we will serve on | |
port = 8000 | |
print("Serving on %s:%s") % (socket.gethostbyname(socket.getfqdn()), port) |
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 <iostream> | |
#include <memory> | |
using namespace std; | |
/** | |
Demonstration of circular dependencies broken with forward declarations. | |
Compile like so: | |
clang++ -std=c++11 -stdlib=libc++ circular.cpp -o build/circular && build/circular | |
*/ |