Skip to content

Instantly share code, notes, and snippets.

<?
require 'parallelcurl.php';
$pc = new ParallelCurl(5);
// Bind $callback and $pc using "use()" construct, because we'll use them inside the closure
$callback = function($content, $url, $ch, $userParams) use (&$callback, $pc) {
// Print status of finished request
$i = $userParams['i'];
@redcapital
redcapital / timer.rb
Last active August 29, 2015 14:08
Simple countdown timer script for Mac OS X
#!/usr/bin/env ruby
if ARGV.empty?
puts 'Usage: timer TIME'
exit
end
TOKENS = { 's' => 1, 'm' => 60, 'h' => 60 * 60 }
def parse_duration(str)
#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <algorithm>
#include <map>
using namespace std;
const int MAX_SQUARES = 6;
@redcapital
redcapital / Rain.php
Created February 3, 2013 14:50
Rain in your terminal. Run with `php Rain.php`
<?php
/**
* Renders rain. The code was like 10 times shorter before moving it into the class
*/
class Renderer
{
protected $width, $height, $text;
private $_middle, $_textBeginPos, $_textLength, $_line;
==2885== Memcheck, a memory error detector
==2885== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al.
==2885== Using Valgrind-3.6.1-Debian and LibVEX; rerun with -h for copyright info
==2885== Command: giomm-test
==2885==
==2885==
==2885== HEAP SUMMARY:
==2885== in use at exit: 93,481 bytes in 1,693 blocks
==2885== total heap usage: 2,493 allocs, 800 frees, 214,414 bytes allocated
==2885==
==3152== Memcheck, a memory error detector
==3152== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al.
==3152== Using Valgrind-3.6.1-Debian and LibVEX; rerun with -h for copyright info
==3152== Command: giomm-test
==3152==
(process:3152): glibmm-CRITICAL **: Glib::ObjectBase* Glib::wrap_create_new_wrapper_for_interface(GObject*, GType): assertion `wrap_func_table != 0' failed
(process:3152): GLib-GObject-CRITICAL **: g_object_set_qdata_full: assertion `quark > 0' failed
==3152==