Skip to content

Instantly share code, notes, and snippets.

View niku's full-sized avatar
💭
🍖

KITAMURA Daisuke niku

💭
🍖
View GitHub Profile
// ==UserScript==
// @name Auto Login bike_news_plus
// @description Enters password in bike_news_plus's login
// @namespace http://niku.name/
// @include http://pita.paffy.ac/news/admin.cgi
// ==/UserScript==
(function() {
pre = document.referrer;
now = document.URL;
<?php
$url = 'http://menu.2ch.net/bbsmenu.html'; //元になるメニュー
$ext_filename = 'link.dat'; //追加サイトを書いたファイル名
$char_code = '<meta http-equiv="Content-Type" content="text/html; charset=shift_jis">'; //文字コード指定(Shift_JIS)
$org_data = file_get_contents($url); //オリジナルデータ読み込み
mb_convert_variables("SJIS","auto",$org_data); //SJISに変換
//ヘッダー部分+<BODY>タグまで切り取り -> $head_dataに格納
//ヘッダー部分に文字コードを追加
// ==UserScript==
// @name automatic moving @mixi
// @description automatic moving script to an external link
// @namespace http://niku.name/
// @include http://mixi.jp/view_diary.pl?url=*
// @include http://mixi.jp/new_friend_diary.pl*
// ==/UserScript==
// style definition for external url
// Ex.
- module: const_list
config:
- http://www.hokkaido-np.co.jp/cont/consa-burn/index_all.html
- module: Filter::get_html
- module: Filter::find_regex
config:
regex: http:\/\/www\.hokkaido-np\.co\.jp\/cont\/consa-burn\/\d+?\.html
- module: Filter::deduped
config:
path: /virtual/niku/pragger_makes/deduped/consa-burn
- module: const_list
config:
- http://hochi.yomiuri.co.jp/soccer/jleague/
- module: Filter::get_html
- module: Filter::find_regex
config:
regex: <a href="\/soccer\/jleague\/news\/.+?\.htm">.+?…札幌<\/a>
- module: Filter::subs
config:
regex: <a href="(\/soccer\/jleague\/news\/.+?\.htm)">.+?…札幌<\/a>
# -*- coding: utf-8 -*-
# How To Use
#
# required three sources
# +-idm2kpx.rb(this)
# +-idm_parser.rb
# +-idm.xml('ID Manager' exported)
#
# %ruby idm2kpx.rb idm.xml keypassx.xml
#
- module: RSS::load
config:
url:
- http://sirase.ru/consadole/news.rdf
- http://sirase.ru/consadole/snews.rdf
- http://sirase.ru/consadole/consa-burn.rdf
- http://sirase.ru/consadole/forza_consadole.rdf
- http://sirase.ru/consadole/hochi_consadole.rdf
- http://www.nikkansports.com/rss/soccer/jleague/consadole.rdf
- module: Filter::deduped
# -*- coding: utf-8 -*-
require 'forwardable'
Address = Struct.new :x, :y do
def self.[] x,y # Address[x,y]
Address.new x,y
end
def adjoinings # 隣接アドレス
x,y = self.x, self.y
# -*- coding: utf-8 -*-
class Array
def delete_each target
self.inject([]) do |result, check|
if index = target.find_index(check)
target.delete_at(index)
else
result << check
end
result
@niku
niku / context_block.rb
Created November 18, 2010 23:54
こんなテストが通るような実装を考えている
require 'rspec'
describe do
it do
ary = [:one, :two]
context(ary) do
send(:[],0)
end.should == :one
end
it do