Skip to content

Instantly share code, notes, and snippets.

Tom van der Woerdt TvdW

Block or report user

Report or block TvdW

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View test.c
#include "curl/curl.h"
int main(int argc, char** argv)
{
CURLM *multi = curl_multi_init();
curl_multi_setopt(multi, CURLMOPT_PIPELINING, CURLPIPE_MULTIPLEX);
curl_multi_setopt(multi, CURLMOPT_MAX_HOST_CONNECTIONS, 4);
int j, all_done = 0;
for (j = 0; j < 100 && !all_done; j++) {
View test.c
#include <string.h>
#include <curl/curl.h>
fd_set wfds;
fd_set rfds;
struct timeval tv;
int maxfd = 0;
int socket_callback(CURL *easy, /* easy handle */
curl_socket_t s, /* socket */
View test.c
#include "curl/curl.h"
int main(int argc, char** argv)
{
CURLM *multi = curl_multi_init();
curl_multi_setopt(multi, CURLMOPT_PIPELINING, CURLPIPE_MULTIPLEX);
curl_multi_setopt(multi, CURLMOPT_MAX_HOST_CONNECTIONS, 4);
int j;
for (j = 0; j < 100; j++) {
View test.c
#include <string.h>
#include <curl/curl.h>
fd_set wfds;
fd_set rfds;
struct timeval tv;
int maxfd = 0;
int socket_callback(CURL *easy, /* easy handle */
curl_socket_t s, /* socket */
View test.c
#include <string.h>
#include <assert.h>
#include <curl/curl.h>
fd_set wfds;
fd_set rfds;
struct timeval tv;
int maxfd = 0;
int socket_callback(CURL *easy, /* easy handle */
View test.c
#include <string.h>
#include <curl/curl.h>
fd_set wfds;
fd_set rfds;
struct timeval tv;
int maxfd = 0;
int socket_callback(CURL *easy, /* easy handle */
curl_socket_t s, /* socket */
View keybase.md

Keybase proof

I hereby claim:

  • I am tvdw on github.
  • I am tvdw (https://keybase.io/tvdw) on keybase.
  • I have a public key whose fingerprint is D6F9 F239 E0C9 D283 5D3D E267 2DB3 6243 CF38 B160

To claim this, I am signing this object:

@TvdW
TvdW / gist:3732203
Created Sep 16, 2012
JSON string encoder, from STL string to JSON
View gist:3732203
static inline std::string jsonEscape(std::string &str)
{
std::string escaped = "\"";
char buf[16];
unsigned int i;
for (i = 0; i < str.size(); i++)
{
if (str[i] == 34) escaped += '\\';
View gist:1073192
// In the header file
@property (retain) NSObject *obj;
// In the code
-(id)init {
// WRONG: obj = [[NSData alloc] init]; // This won't call [obj retain]; !!!!
[self setObj:[[NSData alloc] init]]; // CORRECT: [obj retain]; is called properly
return self;
}
@TvdW
TvdW / gist:1073174
Created Jul 9, 2011
C++ memory object extending
View gist:1073174
class Sheep : Object {
void makeNoise();
};
int main() {
Sheep* sheep = new Sheep; // it is automatically retained once.
// Do stuff with the sheep
sheep.release(); // it is deallocated
You can’t perform that action at this time.