Skip to content

Instantly share code, notes, and snippets.

View mattn's full-sized avatar
🍛
I love curry 🍛

mattn mattn

🍛
I love curry 🍛
View GitHub Profile
require 'net/http'
require 'json'
require 'cgi'
class Lingr
def initialize(api_key)
@api_key = api_key
@http = nil
Net::HTTP.start('www.lingr.com', 80) do |h|
@http = h
Index: src/term.c
===================================================================
--- src/term.c (revision 1318)
+++ src/term.c (working copy)
@@ -5152,7 +5152,7 @@
#ifdef FEAT_MBYTE
/* skip multibyte char correctly */
- for (i = (*mb_ptr2len)(src); i > 0; --i)
+ if ((i = (*mb_ptr2len)(src)) == 1)
use strict;
use warnings;
use URI;
use Web::Scraper;
use YAML;
my $staff = scraper {
process '//table[@width="565" and descendant::a[contains(@href,".asx")] ]', 'entries[]' => scraper {
process 'td.main_title2 > p', title => 'TEXT';
process '//table[@width="553"]//td[@class="main_txt1"]', body => 'TEXT';
From 3add1a3e2a041df91703adc8d32fe9bd4d570465 Mon Sep 17 00:00:00 2001
From: mattn <mattn.jp@gmail.com>
Date: Thu, 15 Jan 2009 17:50:08 +0900
Subject: [PATCH] add cliplife.
---
root/plugins/cliplife.jp/find_enclosures.pl | 16 ++++++++++++++++
root/plugins/cliplife.jp/find_links.yaml | 2 ++
2 files changed, 18 insertions(+), 0 deletions(-)
create mode 100644 root/plugins/cliplife.jp/find_enclosures.pl
" append to syntax/hatena.vim
function SyntaxSuperPre()
let lnum = 1
let lmax = line("$")
let mx = '^>|\(.*\)|$'
while lnum <= lmax
let curline = getline(lnum)
if curline =~ mx
let lang = substitute(curline, mx, '\1', '')
exec 'runtime! syntax/'.lang.'.vim'
@mattn
mattn / c.c
Created January 19, 2009 04:14 — forked from cho45/c.c
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <dirent.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
typedef struct entry {
char* path;
50000got
@mattn
mattn / rfc822parse.js
Created January 28, 2009 10:24
rfc822parse.js
alert(new Date("2009-01-28T19:26:31+09:00".replace(/^(\d+)[\-\/](\d+)[\-\/](\d+)T(\d+:\d+:\d+)([+\-].*)/, function() {
var r = RegExp;
return new Date(new Date([r.$1, r.$2, r.$3].join('/') + ' ' + r.$4 + ' ' + r.$5).getTime() +
+ parseInt(r.$5.replace(/^([\+\-])(\d+):(\d+)$/, function() {
var r = RegExp;
return r.$1 + (Number(r.$2)*3600 + Number(r.$3)*60);
}))).toString()
})).toString())
#!/usr/bin/perl
use strict;
use warnings;
use Config::Pit;
use WWW::Mechanize;
my $file = shift or die("usage: $0 [file]");
my $mech = WWW::Mechanize->new();
@mattn
mattn / MyFilter.pm
Created February 3, 2009 08:03
えっ!それ動くよ!
package MyFilter;
use strict;
use warnings;
use Filter::Simple;
FILTER { s{ \$SIG\{INT\{ }{ \$SIG\{INT\} }x; };
1;