Want to create a Gist from your editor, the command line, or the Services menu? Here's how.
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 net = require('net'); | |
var END = '\r\n'; | |
var groups = ['nodejs.test']; | |
var articles = { | |
'<1@127.0.0.1>' : {body : 'An article.'}, | |
'<2@127.0.0.1>' : {body : 'Another article.'}, | |
}; |
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 <iomanip> | |
// | |
// Utilities | |
// | |
// RETURNS() is used to avoid writing boilerplate "->decltype(x) { return x; }" phrases. | |
// | |
// USAGE: auto function(<arguments>) RETURNS(<some-expression>); | |
// |
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() |
Note: the original location of this article is on my blog, however, it is posted here too for better readability.
In this article, we will see how to use Core Data for accessing your API. We will use the Bandcamp API as our running example. I've only been experimenting with this code for a few days, so there might be mistakes in there.
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 are a few tricks I've used with the trunk versions of clang and libc++ | |
// with C++11 compilation turned on. Some might be obvious, some not, but at | |
// least they are some kind of improvement over their C++03 counterparts. | |
// | |
// Public domain. | |
// ============================================================================= | |
// 1) Using variadic class templates recursively, like in the definitions for | |
// "add<T...>" here: |
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
#import <Foundation/Foundation.h> | |
int main(int argc, const char * argv[]) | |
{ | |
NSRunLoop * runLoop; | |
CLIMain * main; // replace with desired class | |
@autoreleasepool | |
{ | |
// create run loop |
OlderNewer