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
// Copyright Dave Abrahams 2011. Distributed under the Boost | |
// Software License, Version 1.0. (See accompanying | |
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | |
#include <iostream> | |
#include <iomanip> | |
#include <boost/math/constants/constants.hpp> | |
#ifndef TRACE | |
# define CONSTEXPR constexpr | |
#else |
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 <exception> | |
#include <cassert> | |
struct tracked | |
{ | |
int id; | |
static int next; | |
tracked() |
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
// Here is a traits structure I wrote to be able to determine if a function with | |
// a given name can be called in the context defined by a signature. This was | |
// originally not possible in C++03 - or at least a one solution works everywhere | |
// did not exist AFAIK. | |
// | |
// Olivier Grant | |
// | |
#include <iostream> | |
#include <iomanip> |
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
@protocol APRemoteAddressBook <NSObject> | |
- (void) allPeople: (void (^)(NSArray *, NSError *)) reply; | |
- (void) mailingAddressesForPersonWithIdentifier: (NSString *) identifier | |
reply: (void (^)(NSArray *, NSError *)) reply; | |
- (void) emailAddressesForPersonWithIdentifier: (NSString *) identifier | |
reply: (void (^)(NSArray *, NSError *)) reply; | |
- (void) phoneNumbersForPersonWithIdentifier: (NSString *) identifier | |
reply: (void (^)(NSArray *, NSError *)) reply; | |
@end |
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 <boost/array.hpp> | |
namespace boost | |
{ | |
template<typename T> | |
inline boost::array<T, 0> | |
make_array() | |
{ | |
boost::array<T, 0> res; |
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
#!/bin/sh | |
# FindInFile.sh | |
# | |
# | |
# Created by Gregory Hill on 2/28/13. | |
# | |
# Usage: | |
# ./FindInFile.sh <baseDir> | |
# e.g. ~/Desktop/Code/Pandora/dev/Pandora |
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
// Asynchronous read | |
let task = NSURLSession.sharedSession().streamTaskWithHostName("chat.example.com", port: 5555)! | |
task.resume() | |
task.readDataOfMinLength(16384, maxLength:65536, timeout: 30.0) { | |
(data: NSData?, eof: Bool, error: NSError?) in | |
// | |
} |
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
#pragma mark - GCDAsyncSocketDelegate | |
- (void)socket:(GCDAsyncSocket *)sock didConnectToHost:(NSString *)host port:(uint16_t)port { | |
[self secureSocket:sock]; | |
} | |
// We are connecting to server with self-signed certificate and don't include the certificate | |
// (public key .pem) in the client. So we skip all the cert checking. To actually check, see | |
// http://stackoverflow.com/questions/9874932/ssl-identity-certificate-to-run-an-https-server-on-ios | |
- (void)secureSocket:(GCDAsyncSocket *)sock { | |
// It has been changed in CocoaAsyncSocket v7.4, some old option keys are now unavailable and will throw exception. | |
// Use GCDAsyncSocketManuallyEvaluateTrust and evaluate in -socket:didReceiveTrust: delegate instead. |
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
/** | |
* Implemention from here: http://www-igm.univ-mlv.fr/~lecroq/string/node14.html#SECTION00140 | |
*/ | |
extension String { | |
private func preBmBc(forString x: String) -> [Character: Int] { | |
let m = x.characters.count | |
var bmBc = [Character: Int](/*count: alphabetSize, repeatedValue: m*/) | |
for i in 0...m - 2 { |
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/perl | |
=com | |
PURPOSE | |
This script will | |
Force you through a comprehensive quality-control checklist | |
Run Deploymate | |
Get the latest version number by reading it from product's Info.plist |
OlderNewer