Skip to content

Instantly share code, notes, and snippets.

# 現在のユーザー名とホスト名をタイトルに
$global:currentuser = [System.Security.Principal.WindowsIdentity]::GetCurrent()
$user_and_host = ($currentuser.name -replace "(.*?)\\(.*?)$", "`$2@`$1")
$Host.UI.RawUI.WindowTitle = $user_and_host + " - Windows PowerShell"
# プロンプトのカスタマイズ
function prompt {
write-host ""
# ディレクトリの表示 (バックスラッシュをスラッシュに変換)
# show Git branch name with some informations
# normal: ~/git/foo (master)
# something to commit: ~/git/foo (master*)
# not pushed to origin: ~/git/foo (master!)
# something to commit and not pushed to origin: ~/git/foo (master*!)
# Git: get branch status
function git_get_branch_status {
local STATUS=`git status 2> /dev/null | tail -n1`
[[ ${STATUS} != "nothing to commit (working directory clean)" ]] && echo -ne "*"
function formatNameAndEmail(name, email) {
if (typeof name !== "string" || typeof email !== "string") {
throw "InputIsNotString";
} else if (formatNameAndEmail.arguments.length > 2) {
throw "ArgumentsTooLong";
} else {
return name + " <" + email + ">";
}
}
@rem = '--*-Perl-*--
@echo off
if "%OS%" == "Windows_NT" goto WinNT
perl -x -S "%0" %1 %2 %3 %4 %5 %6 %7 %8 %9
goto endofperl
:WinNT
perl -x -S %0 %*
if NOT "%COMSPEC%" == "%SystemRoot%\system32\cmd.exe" goto endofperl
if %errorlevel% == 9009 echo You do not have Perl in your PATH.
if errorlevel 1 goto script_failed_so_exit_with_non_zero_val 2>nul
@hail2u
hail2u / kakaku.com-specsearch-permalink.user.js
Created May 11, 2009 10:30
価格.comのスペック検索の結果ページのpermalinkをわかりやすく挿入
// ==UserScript==
// @name Gomidashi
// @namespace http://hail2u.net/
// @description eco.
// @include http://mail.google.com/*
// @include https://mail.google.com/*
// ==/UserScript==
window.addEventListener('load', function () {
var garbageSchedule = [
var nodes = document.querySelectorAll("*"),
l = nodes.length,
i,
matches = [],
j,
m,
color,
colors = {},
doc = document,
styles = doc.styleSheets,
// https://developer.mozilla.org/ja/Core_JavaScript_1.5_Reference/Functions#.e5.86.8d.e5.b8.b0
// ちょっと短く書きやすい
function walkTree (node) {
if (node === null) return;
// do something with "node"
Array.forEach(node.childNodes, walkTree);
}
walkTree(document);
// ==UserScript==
// @namespace http://hail2u.net/
// @include http://b.hatena.ne.jp/entry/*
// @include http://b.hatena.ne.jp/entry?mode=more&url=*
// ==/UserScript==
Array.forEach(document.getElementsByClassName("plus_icon"), function (plus) {
plus.innerHTML = "はてなの奴隷だお^^";
});
@hail2u
hail2u / jquery.tablefilter.js
Created May 26, 2009 16:04
インクリメンタル・サーチでtableの行を絞り込むフォームをtable要素の前に挿入するjQueryプラグイン。
/**
* jquery.tablefilter.js - version 0.1.1
* Insert a input form for filtering rows dinamically.
*
* Copyright (c) 2009 Kyo Nagashima <[email protected]>
* This library licensed under MIT license:
* http://opensource.org/licenses/mit-license.php
*
* Usage:
* Insert to all table