Skip to content

Instantly share code, notes, and snippets.

View moroya's full-sized avatar

moroya moroya

View GitHub Profile
@moroya
moroya / fix-translate.js
Created December 23, 2023 06:22
ChromeのGoogle翻訳で <code> タグの語順がおかしくなるのを修正するブックマークレット
function getParentBlock(el) {
for (let p = el; p; p = p.parentNode) {
const style = window.getComputedStyle(p, null);
if (style && style.getPropertyValue("display") !== "inline") {
return p;
}
}
return null;
}
@moroya
moroya / prime-video-pip.js
Created October 24, 2019 13:11
MacのSafariでPrime Videoを再生しながらコンソールにコピペするとピクチャーインピクチャーで再生してくれるコード
Array.from(document.getElementsByTagName("video")).find(el => /^blob/.test(el.src)).webkitSetPresentationMode("picture-in-picture");
@moroya
moroya / okokok.js
Last active December 27, 2015 11:19
「オケオケオッケー」の中からランダムに文字列を返して、130回以内に「オケオケオッケー」に一致する文字列が出たら[それまでの試行結果]+"\n"+n+"回目の試行で成功" 出なかったら[それまでの試行結果]+"\nFailed" とツイートするクソコード
javascript:c='オケオケオッケー';l=130;r='';p=c.split('');for(i=0;i<l;i++){r+=p[~~(Math.random()*p.length)];if(r.substr(p.length*-1)==c)break;}l==i?r+='\nFailed':r+='\n'+(i+1)+'回目の試行で成功';location.href='https://twitter.com/intent/tweet?text='+encodeURIComponent(r);
@moroya
moroya / nico_mylist_search.js
Created October 17, 2013 15:15
Niconico Mylist Search ブックマークレット(GINZA)
/***** Niconico Mylist Search ブックマークレット *****
ニコニコ動画のマイリストをインクリメンタルサーチします。
@auther : moroya http://moroya.hatenablog.jp/
@license: MIT License
*/
(function($){
if(location.href.indexOf('www.nicovideo.jp/my/mylist') === -1) {
if(window.confirm('このページはニコニコ動画の\nマイリストページではありません\nマイリストページへジャンプしますか?')) {
location.href="http://www.nicovideo.jp/my/mylist";
@moroya
moroya / aitter.js
Last active December 18, 2015 00:39
Amazon ikuratukatter
(function(){
var total = {};
var year = '2012';
var all = false;
function init(num) {
if(typeof num !== 'number') {
num = 0;
$('<div/>').css({
position: 'fixed',
left: 0,
<VirtualHost *:80>
ServerName example.net
DocumentRoot "/var/html/www/"
<Directory "/var/html/www/">
Order Allow,Deny
Allow from All
AllowOverride All
Options FollowSymLinks
</Directory>
@moroya
moroya / httpd.conf
Created May 17, 2013 15:18
httpd.conf
### Section 1: Global Environment
### Apache全体に影響を及ぼすセクション
# Apacheのパス
ServerRoot "/etc/httpd"
# ポート番号の指定
Listen 80
# 同時接続数
@moroya
moroya / gist:5585431
Last active December 17, 2015 09:09
image download
var imgs = document.querySelectorAll('a[href*="jpg"], a[href*="gif"], a[href*="png"]');
for(var i=0;i<imgs.length;i++) {
dispatchMouseEvents({ type:'click', altKey:true, target:imgs[i], button:0 });
}
function dispatchMouseEvents(opt) {
var evt = document.createEvent('MouseEvents');
evt.initMouseEvent(opt.type, opt.canBubble||true, opt.cancelable||true, opt.view||window,
opt.detail||0, opt.screenX||0, opt.screenY||0, opt.clientX||0, opt.clientY||0,
@moroya
moroya / screenshot.js
Created May 8, 2013 15:43
phantomjs screenshot test
var page = require('webpage').create();
var system = require('system');
// 引数を引っ張る
var address = system.args[1];
var output = system.args[2];
var delay = Number(system.args[3]);
// ビューポートのサイズ
page.viewportSize = {
// first
function first() {
var df = $.Deferred();
setTimeout(function(){
console.log('first');
df.resolve();
}, 1000);
return df.promise();