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
use strict; | |
use Irssi; | |
use URI::Find::Rule; | |
use REST::Client; | |
use URI::Escape; | |
use vars qw($VERSION %IRSSI); | |
$VERSION = '0.01'; | |
%IRSSI = ( |
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 <windows.h> | |
#include <sapi.h> | |
int wmain(int argc, wchar_t** argv) | |
{ | |
ISpVoice *pVoice; | |
CoInitialize(0); | |
CoCreateInstance(CLSID_SpVoice, NULL, CLSCTX_ALL, IID_PPV_ARGS( &pVoice ) ); |
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 <vector> | |
#include <iostream> | |
template<template<typename Q> class T> | |
struct Mu { | |
T<Mu<T> > In; | |
}; | |
template<typename T> | |
struct Ptr { |
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
Shoes.app do | |
@log = [] | |
@entries = stack do | |
@entry = edit_line | |
flow do | |
button("Add text") { | |
@log << "TXT #{@entry.text}" | |
@entries.append { title @entry.text } | |
} |
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
struct at_scope_exit : private std::function<void()> { | |
at_scope_exit(std::function<void()> do_this) : std::function<void()>(do_this) | |
{} | |
~at_scope_exit() | |
{ | |
(*this)(); | |
} | |
}; |
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
class resource { | |
mutex m_; | |
condition_variable cv_; | |
public: | |
resource() {} | |
void with_do(std::function<void()> body) | |
{ | |
m_.lock(); | |
at_scope_exit u( [&]() { cv_.notify_all(); m_.unlock(); } ); |
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
struct counter : resource { int c; } r; | |
r.with_do([&]() | |
{ | |
r.c += 1; | |
r.with_do([&]() { r.c += 1; }); | |
}); |
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
r.with_do([&]() | |
{ | |
r.c += 1; | |
counter& shadow = r; | |
r.with_do([&]() { shadow.c += 1; }); | |
}); |
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
auto incr = [&]() { r.c += 1; }; | |
r.with_do([&]() | |
{ | |
r.c += 1; | |
r.with_do(incr); | |
}); |
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
class resource { | |
recursive_mutex m_; | |
condition_variable cv_; | |
public: | |
resource() {} | |
void with_do(std::function<void()> body) | |
{ | |
m_.lock(); | |
at_scope_exit u( [&]() { cv_.notify_all(); m_.unlock(); } ); |
OlderNewer