Skip to content

Instantly share code, notes, and snippets.

View jamadam's full-sized avatar

Keita Jamadam Sugama jamadam

  • Tokyo / Sapporo, Japan
View GitHub Profile
@jamadam
jamadam / gist:e96639e792bd119080c7bbc8d3e3e894
Created December 12, 2022 16:09
SQL debug print for movabletype
package MT::Test::DebugSQL;
use strict;
use warnings;
our $TRY_TO_EMBED_BIND_ARRAY = 1;
my $started = 0;
my $start_query_org;
sub wrap {
@jamadam
jamadam / 00-intro.md
Created June 29, 2020 11:19 — forked from mdo/00-intro.md
Instructions for how to affix an Ikea Gerton table top to the Ikea Bekant sit-stand desk frame.

Ikea Bekant standing desk with Gerton table top

@jamadam
jamadam / gist:5d22fc50688d89b1bd3d
Last active January 27, 2016 16:45
original code
# login
my $tx1 = $ua->get($urlbase->clone->path('/admin/login'));
my $tx2 = post_form_by_dom($tx1->res->dom->at('#form'), $ua, $urlbase, {
'_method' => 'POST',
'data[AdminUser][username]' => 'test',
'data[AdminUser][password]' => 'test',
});
$tx2->res->dom->find('.container td a')->each(sub($a, $) {
my $url = $urlbase->clone->parse($a->attr('href'));
@jamadam
jamadam / gist:b608cf5ad73c190bde03
Created January 27, 2016 15:50
Minimum reproduction code for '(in cleanup) Can't use an undefined value as a symbol reference at lib/Mojo/Asset/File.pm line 43 during global destruction.'
use strict;
use warnings;
use Mojo::IOLoop;
use Mojo::Asset::File;
my @files;
my $id;
$id = Mojo::IOLoop->recurring(0, sub {
my $file = Mojo::Asset::File->new;
$file->add_chunk('');
@jamadam
jamadam / gist:c20c00433645e0deeeaf
Last active August 29, 2015 14:01
SOP違反でエラーになる
<!DOCTYPE html>
<title></title>
<meta charset="UTF-8" />
<script>
var request = new XMLHttpRequest();
request.open('GET', 'http://dev.skyarc.org/cgi-bin/mt/mt-data-api.cgi/v1/sites/1', false);
request.send();
</script>
</div>
$(function(){
var api = new MT.MTDataAPIYetAnother({
//baseUrl:"http://192.168.56.101:5000/mt-data-api.cgi",
//baseUrl:"http://127.0.0.1:5000",
baseUrl:<$MTCGIPath$>mt-data-api.cgi,
internalLimit: 1000
});
var routes = {
/**
* 最新のエントリー一覧
*/
api.listEntries(<$MTBlogID$>, {limit:10}, function(res){
for (idx in res.items) {
var item = res.items[idx];
var cont = $(".layouts > .entryContainer").clone();
cont.find(".title").html(item.title);
cont.find(".body").html(item.excerpt);
$(".main").append(cont);
$(function(){
var api = new MT.MTDataAPIYetAnother({
baseUrl:"<$MTCGIPath$>mt-data-api.cgi",
internalLimit: 1000
});
/**
* ブログタイトルを表示
*/
#!/usr/bin/env perl
use strict;
use warnings;
use Mojo::UserAgent;
my $ua = Mojo::UserAgent->new;
$ua->inactivity_timeout(1);
$ua->get('http://cpan.org/');
@jamadam
jamadam / mojo_dom_tests.t
Created June 25, 2012 11:53
Mojo::DOM tests
sub dom {
return Mojo::DOM->new(<<EOF);
<div id="div1">
A
<a>B</a>
<a>C</a>
<span>D</span>
</div>
<div id="div2">
E