Skip to content

Instantly share code, notes, and snippets.

@mashiro
mashiro / booklive-delete-notification.bookmarklet.js
Last active March 5, 2021 08:52
BookLive! の作品ページでフォロー解除ができるようにするブックマークレット
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 November 25, 2020 06:14
LINE DEVDAY のセッション一覧をちょっと見やすくする User Style
.SessionPanel_inactive__3UvF1 .SessionPanel_panel__1Oz0y {
color: #888;
}
.SessionPanel_container__3iORH .SessionPanel_title__1iwdo span {
color: #ddd;
}
.SessionPanel_container__3iORH {
word-break: break-word;
}
# @param {Integer[]} nums
# @return {String[]}
def summary_ranges(nums)
return [] if nums.empty?
prev = nums.shift
r = [prev]
out = []
nums.each do |n|
/**
* 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())
# 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 October 3, 2020 17:12
K-diff Pairs in an Array
# @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
module.exports = {
root: true,
env: {
es6: true,
node: true,
},
extends: [
'standard',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
set clipboard=unnamed,unnamedplus
set visualbell
set surround
" escape
noremap <C-j> <C-[>
inoremap <C-j> <C-[>
" emacs like
noremap <C-a> <Home>
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);
import "./point.dart";
import "./print.dart";
void main() {
var p = new Point(1, 2);
printPoint(p);
}