Skip to content

Instantly share code, notes, and snippets.

#include <iostream>
#include <boost/lexical_cast.hpp>
template <typename Result>
class manip
{
public:
typedef manip base_type;
typedef std::ios_base::fmtflags flags_type;
typedef Result result_type;
module EventMachine
module Twitter
class Connection < EM::Connection
public :on_headers_complete, :on_body
end
end
end
require 'nokogiri'
require 'cgi'
class Google
include Donkun::Plugin
match /(?:google|g)\s+(.+)/
def execute(m, query)
m.target.notice search(query)
end
<html class="normal" type="channel" channelname="#test">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Script-Type" content="text/javascript">
<meta http-equiv="Content-Style-Type" content="text/css">
<style>
html {font-family:'Osaka-Mono';font-size:10pt;background-color:white;color:black;word-wrap:break-word;margin:0;padding:3px 4px 10px 4px;}
body {margin:0;padding:0}
img {border:1px solid #aaa;vertical-align:top;}
object {vertical-align:top;}
#include <iostream>
#include <boost/chrono.hpp>
#include <boost/asio.hpp>
#include <boost/asio/steady_timer.hpp>
#include <boost/bind.hpp>
namespace asio = boost::asio;
using asio::ip::tcp;
class client
if ($matched) {
Auto::Utils::sendto_channel_closure(
$receiver, $command, undef, undef, undef, 0
)->($text);
my $log_channel = $this->_runloop->mod_manager->get('Log::Channel');
if ($log_channel) {
$log_channel->message_arrived(
Tiarra::IRC::Message->new(
Command => $command,
$response = '';
while (!feof($this->_socket_resource)) {
$response .= fgets($this->_socket_resource, 128);
}
// $response = fgets($this->_socket_resource, 128);
if(!preg_match('@^' . preg_quote(Net_Socket_Tiarra::protocol, '@') . ' 200 OK@', $response)) {
throw new Net_Socket_Tiarra_Exception("error: " . $response);
};
fclose($this->_socket_resource);
val ids = new VIntArrayWritable
override def reduce(key: IntWritable, values: Iterable[VIntArrayWritable], context: Context): Unit = {
ids.set(values.map(_.toArray.asInstanceOf[Array[IntWritable]].toList).fold(Nil)(_ ++ _).distinct.toArray)
context.write(key, ids)
}
-- data.txt
-- 10 1,2,3
-- 20 1,2
A = LOAD 'data.txt' USING PigStorage('\t') AS (key:int, values:chararray);
-- B = FOREACH A GENERATE key, FLATTEN(TOKENIZE(values, ',')) AS (value:int);
B = FOREACH A GENERATE key, FLATTEN(TOKENIZE(values, ',')) AS value;
C = FOREACH B GENERATE key, (int)value;
D = FILTER C BY value > 1;
DUMP D;
module WhereLikeExtension
def where_like(opts, *rest)
return self if opts.blank?
spawn.where_like! opts, *rest
end
def where_like!(opts, *rest)
self.where_values += build_where(opts, rest).map { |r| Arel::Nodes::Matches.new r.left, r.right }
self
end