Skip to content

Instantly share code, notes, and snippets.

@silvers
silvers / Confluence Better Search - Changelog
Last active October 28, 2020 02:40
Confluence: Change from OR search to AND search.
## 2020/10/28 v0.4
* fix(suggest): submit -> click
## 2020/10/09 v0.3
* feature(replace): add on/off switch
* feature(suggest): suggest by first load
* feature(suggest): speedy suggest
## 2020/10/09 v0.2
* fix(*): fixed incorrect replace
@silvers
silvers / auto-close-zoom-tab.user.js
Last active June 26, 2020 01:46
zoomのタブから離れたら閉じる君
// ==UserScript==
// @name Close Zoom Tab
// @namespace http://tampermonkey.net/
// @version 0.3
// @description close zoom tab on success
// @author silvers
// @match https://*.zoom.us/j/*
// @match https://zoom.us/j/*
// @grant window.close
// ==/UserScript==
@silvers
silvers / meeting
Last active April 21, 2020 09:28
https://github.com/benbalter/zoom-go を利用して対話的にzoomを開けるようにする
#!/bin/sh
IFS='
'
hr='_____________________________________________________'
for line in $(zoom --count 3); do
if [[ $line =~ (zoommtg://.*)$ ]]; then
url=$BASH_REMATCH
fi
@silvers
silvers / Array+safe.swift
Last active May 17, 2018 15:33
swift array extension
extension Array {
subscript (safe index: Int) -> T? {
get {
return indices(self) ~= index ? self[index] : nil
}
set (value) {
if value == nil {
return
}
@silvers
silvers / .gitignore
Created August 5, 2014 12:01
ignore file for unity
Library
Temp
*.pidb
*.unityproj
*.sln
*.userprefs
@silvers
silvers / twitter_bot.pl
Created December 1, 2013 08:29
twitter_bot 二年ぐらい前のapiがアレする前に書いたやつなので動かないよ。
use strict;
use warnings;
use utf8;
use lib "$ENV{HOME}/extlib/lib/perl5";
use AnyEvent;
use AnyEvent::Feed;
use AnyEvent::IRC::Client;
use Encode;
use Encode::Guess;
@silvers
silvers / pre-commit-compile-css
Created July 2, 2013 08:14
if git-add *.scss, then compile.
#!/bin/sh
NAME=$(git branch | grep '*' | sed 's/* //')
# don't run on rebase
if [ $NAME != '(no branch)' ]; then
EDITSCSS=$(git --no-pager diff --diff-filter=AM --name-only --no-color --cached | grep 'scss' | wc -l)
if [ $EDITSCSS -ne 0 ]; then
@silvers
silvers / length.js
Last active December 14, 2015 15:09
obj.length === +obj.length
var test = function(obj) {
console.log(obj);
console.log(obj.length);
console.log(+obj.length);
if (obj.length === +obj.length) {
console.log("array!!!");
} else {
console.log("object!!!");
}
@silvers
silvers / split-test.pl
Last active December 12, 2015 04:08
If LIMIT is omitted, split removes trailing empty fields. If LIMIT is negative, split keeps all fields.
#!/usr/bin/perl
use strict;
use warnings;
use 5.10.0;
my $str = 'aaa::bbb:::fff::::';
# no limit
my @array1 = split /:/, $str;
say join ',', @array1; # => aaa,,bbb,,,fff
@silvers
silvers / sprite_maker.pl
Created August 31, 2012 04:04
Generating image and css for CSS Sprite.
use strict;
use warnings;
use File::Basename;
use File::Find::Rule;
use Getopt::Long;
use Image::Imlib2;
sub main {
Getopt::Long::GetOptions(
'--dir=s' => \my $target_dir,