Skip to content

Instantly share code, notes, and snippets.

class Hoge
{ Q_OBJECT;
public:
Hoge();
private slot:
void OnButtonClicked(bool);
private:
QPushButton *button_
import System.Threading
rnd = System.Random()
data = (rnd.Next(100) for i in range(100))
for t in (Thread({Thread.Sleep(i*100); print i}) for i in data):
t.Start()
@turugina
turugina / mditest.boo
Created March 28, 2011 10:45
test script for detecting KeyDown event for arrow keys on MdiChild Form.
import System
import System.Windows.Forms;
class Parent(Form):
public def constructor():
self.IsMdiContainer = true
_btn = Button(Text: "Create Child")
_btn.Click += self.CreateChild
self.Controls.Add(_btn)
@turugina
turugina / gist:875552
Created March 18, 2011 03:04
NHK_PRが「まろ」と呟いたらメールで通知するスクリプト(やっつけ)
use strict;
use warnings;
use utf8;
#===============================
my $consumer_key = '';
my $consumer_secret = '';
my $access_token = '';
my $access_token_secret = '';
#!perl
use strict;
use warnings;
use utf8;
use XML::RSS;
use Growl::Any;
use LWP::UserAgent;
use File::Temp qw/:POSIX/;
use HTTP::Status qw/:constants/;
use Scope::Guard;
#include <iostream>
#include <limits>
#include <boost/timer.hpp>
struct BitTest {
int i;
bool a : 1;
};
diff --git a/lib/AnyEvent/Twitter/Stream.pm b/lib/AnyEvent/Twitter/Stream.pm
index 34f4539..4ba412c 100644
--- a/lib/AnyEvent/Twitter/Stream.pm
+++ b/lib/AnyEvent/Twitter/Stream.pm
@@ -154,7 +154,7 @@ sub new {
my($handle, $json) = @_;
# Twitter stream returns "\x0a\x0d\x0a" if there's no matched tweets in ~30s.
$set_timeout->();
- if ($json) {
+ if ($json && $json =~ /^{/) {
@turugina
turugina / gist:818122
Created February 9, 2011 07:56
basic example of BDB::Wrapper
use strict;
use warnings;
use BDB::Wrapper;
my $dbfile = '/path/to/file.bdb';
my $wrap = BDB::Wrapper->new;
if ( my $h = $wrap->create_write_dbh($dbfile) ) {
local @SIG{qw/INT TERM QUIT/};
use strict;
use warnings;
use utf8;
use Win32::GuiTest qw/:ALL/;
use Time::HiRes qw/sleep/;
UnicodeSemantics(1);
my $setupexe = "d:/tmp/cygwin/setup.exe";
@turugina
turugina / htmlscrapetest.clj
Created January 14, 2011 06:59
html scraping test /clojure
(ns htmlscrapetest
(:require [clojure.xml :as xml]
[clojure.zip :as zip]
[clojure.contrib.zip-filter :as z]
[clojure.contrib.zip-filter.xml :as zf])
(:use [clojure.java.io :only [as-file]])
; http://htmlcleaner.sourceforge.net/
(:import [org.htmlcleaner CleanerProperties CompactXmlSerializer HtmlCleaner])
)