Skip to content

Instantly share code, notes, and snippets.

@mashiro
mashiro / booklive-delete-notification.bookmarklet.js
Last active Mar 5, 2021
BookLive! の作品ページでフォロー解除ができるようにするブックマークレット
View booklive-delete-notification.bookmarklet.js
javascript:(function(){var e=function(){var c,a,b;return null==(a=null==(c=document.querySelector("link[rel='canonical']"))?void 0:c.href)?void 0:null==(b=a.match(/title_id\/(\d+)\//))?void 0:b[1]}();null==e?alert("Can't get title-id."):function(c){var a=document.createElement("iframe");a.src="/follow/title-list";document.querySelector("body").appendChild(a);var b=a.contentWindow;b.addEventListener("DOMContentLoaded",function(){var f=b.document.querySelector("#title_list_form input[name='token']").value,d=new FormData;d.append("token",f);d.append("title_id[]",c);d.append("notice_type",1);fetch("/follow/notification-delete",{method:"POST",body:d}).then(function(){location.reload()})})}(e)})();
@mashiro
mashiro / gist:cc9ff59fa2bdbd990261cef049cedc8b
Created Nov 25, 2020
LINE DEVDAY のセッション一覧をちょっと見やすくする User Style
View gist:cc9ff59fa2bdbd990261cef049cedc8b
.SessionPanel_inactive__3UvF1 .SessionPanel_panel__1Oz0y {
color: #888;
}
.SessionPanel_container__3iORH .SessionPanel_title__1iwdo span {
color: #ddd;
}
.SessionPanel_container__3iORH {
word-break: break-word;
}
View summary_ranges.rb
# @param {Integer[]} nums
# @return {String[]}
def summary_ranges(nums)
return [] if nums.empty?
prev = nums.shift
r = [prev]
out = []
nums.each do |n|
View cloneGraph.kt
/**
* Definition for a Node.
* class Node(var `val`: Int) {
* var neighbors: ArrayList<Node?> = ArrayList<Node?>()
* }
*/
class Solution {
fun cloneGraph(node: Node?): Node? {
return cloneGraph(node, mutableMapOf())
View cloneGraph.rb
# Definition for a Node.
# class Node
# attr_accessor :val, :neighbors
# def initialize(val = 0, neighbors = nil)
# @val = val
# neighbors = [] if neighbors.nil?
# @neighbors = neighbors
# end
# end
@mashiro
mashiro / find_pairs.rb
Last active Oct 3, 2020
K-diff Pairs in an Array
View find_pairs.rb
# @param {Integer[]} nums
# @param {Integer} k
# @return {Integer}
def find_pairs(nums, k)
if k == 0
return nums.group_by { |n| n }
.map { |k, v| [k, v.size] }
.filter { |(n, c)| c >= 2 }
.size
end
View .eslintrc.js
module.exports = {
root: true,
env: {
es6: true,
node: true,
},
extends: [
'standard',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
View .ideavimrc
set clipboard=unnamed,unnamedplus
set visualbell
set surround
" escape
noremap <C-j> <C-[>
inoremap <C-j> <C-[>
" emacs like
noremap <C-a> <Home>
View video-gain.js
const gain = ((el) => {
const ctx = new window.AudioContext();
const source = ctx.createMediaElementSource(el);
const gain = ctx.createGain();
source.connect(gain);
gain.connect(ctx.destination)
return (multiplier) => { gain.gain.value = Math.min(multiplier, 10); };
})(document.querySelector("video"));
gain(2);
View main.dart
import "./point.dart";
import "./print.dart";
void main() {
var p = new Point(1, 2);
printPoint(p);
}