Skip to content

Instantly share code, notes, and snippets.

@turugina
turugina / calcs.pl
Last active August 29, 2015 14:22
緯度経度3点から大体の面積を求める
use strict;
use warnings;
use utf8;
use Math::Trig;
use v5.12;
# lat 緯度 lng 経度
<html>
<head>
<script src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("jquery", "1.3.1");
</script>
</head>
<body>
<div class="test">
<script type="text/javascript">
<?xml version="1.0"?>
<html xmlns="http://www.w3.org/199/xhtml">
<body>
<script src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("jquery", "1.3.1");
</script>
<script type="text/javascript">
$(function() {
var t1 = $("#test1");
=== modified file 'Makefile.PL'
--- Makefile.PL 2010-08-24 05:03:18 +0000
+++ Makefile.PL 2010-08-24 06:21:15 +0000
@@ -20,6 +20,7 @@
test_requires 'Test::More' => 0.88; # done_testing()
test_requires 'Test::Requires';
+test_requires 'IPC::Run';
#test_requires 'Test::LeakTrace';
#include <iostream>
template<typename D>
struct Hige
{
void hige() { static_cast<D*>(this)->doit(); } // <- **
};
class Hoge
: Hige<Hoge>
ps x -o pid,cmd| perl -anle 'BEGIN{chomp($i=`date --date "5 hour ago" +%Y%m%d%H%M%S`)} $_=$F[3]; print $F[0] if defined and /\d{14}/ and $_ lt $i'
@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])
)
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 / 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/};
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 =~ /^{/) {