Skip to content

Instantly share code, notes, and snippets.

View apple502j's full-sized avatar
🍎
Eaten

apple502j apple502j

🍎
Eaten
View GitHub Profile
@apple502j
apple502j / file0.txt
Created November 2, 2018 03:03
QiitaのTwitter共有がバグってるのでさっそく分析してみる ref: https://qiita.com/apple502j/items/fea853587dd9caccd7b9
// ==UserScript==
// @name Twitter fix
// @version 1.0
// @description Fix twitter link
// @author apple502j
// @match https://qiita.com/advent-calendar/*
// ==/UserScript==
window.addEventListener("load", function(){
for (const item of document.querySelectorAll("a.twitter-share-button")) item.href += "?url=" + item.dataset.url;
@apple502j
apple502j / ExtLinker.py
Created November 29, 2018 06:32
Botのプログラムです。Licensed under BSD-2-clause
from time import sleep
import re
import mw_api_client as mw
ja=mw.Wiki("https://ja.scratch-wiki.info/w/api.php","ExtLinker by Apple502j")
ja.login("username","password")
summary="Scratchリンクの内部リンク化 (Bot)"
l=ja.exturlusage(
import time
from urllib.parse import unquote
import re
import mw_api_client as mwc
try:
with open(".lastpage-iw", "r", encoding="utf-8") as f:
lastpage = f.read()
except OSError:
lastpage = ""
mw.loader.load("https://ja.scratch-wiki.info/w/load.php?debug=false&lang=ja&modules=ext.inputBox.styles%7Cmediawiki.legacy.commonPrint%2Cshared%7Cmediawiki.sectionAnchor%7Cmediawiki.skinning.interface%7Cmediawiki.ui.button%2Ccheckbox%2Cinput%7Cskins.scratchwikiskin2&only=styles&skin=scratchwikiskin2", "text/css")
$("#firstHeading")[0].innerText=document.title="なんでも検索";
$("#mw-content-text")[0].innerHTML=`<div class="mw-inputbox-centered">
<input class="mw-inputbox-input mw-ui-input mw-ui-input-inline" type="text" placeholder="検索ワードを入力" value="" id="keyword" size="50"><br>
<input type="button" class="mw-ui-button mw-ui-progressive" value="なんでも検索!" id="btn">
</div>
<div class="search-results"></div>
`;
document.getElementById("btn").addEventListener("click", () => {
@apple502j
apple502j / FAQ.txt
Last active September 25, 2019 14:56
ToC
Coroutines
What is a coroutine?
Where can I use await?
What does “blocking” mean?
Discord: NEW
# All Discord emojis
UNICODE_EMOJI_REGEX = r'[\u00a9\u00ae\u2122\u2194-\u2199\u21a9\u21aa\u231a\u231b\u2328\u23e9-\u23f3\u23f8-\u23fa\u24c2\u25b6\u25c0\u2600-\u2604\u260e\u2611\u2614\u2615\u2618\u261d\u2620\u2622\u2623\u2626\u262a\u262e\u262f\u2638-\u263a\u2640\u2642\u2648-\u2653\u265f\u2660\u2663\u2665\u2666\u2668\u267b\u267e\u267f\u2692-\u2697\u2699\u269b\u269c\u26a0\u26a1\u26aa\u26ab\u26b0\u26b1\u26bd\u26be\u26c4\u26c5\u26c8\u26ce\u26cf\u26d1\u26d3\u26d4\u26e9\u26ea\u26f0-\u26f5\u26f7-\u26fa\u26fd]'
@apple502j
apple502j / leave-studio.js
Created June 12, 2020 11:08
Leave studios easily
let username = '';
const leaveStudioConstructor = (studioId, elem) => (e => {
e.preventDefault();
e.stopPropagation();
if (!username) return;
$.ajax({type: 'PUT', url: `https://scratch.mit.edu/site-api/users/curators-in/${studioId}/remove/?usernames=${username}`});
});
const getStudioIdFromMediaItemContent = mediaItemContent => mediaItemContent.children[0].children[0].href.match(/\d+/g)[0];
Two questions; 1) do you think cloud data is "useful"? Previously there was more freedom about what we can do with cloud data, like sharing pixel arts or platformer levels - and most are now harder to make because of new rules about cloud data usage. I know it's hard to moderate, but there are some interesting movements that are going totally opposite - user-created websites. Recently they got rid of the registration part (which is great because lots of Japanese people there couldn't...
...understand it.) While the restrictions for the website are still the same, I feel like they are doing what you do with the cloud data. (Or is that just because Paddle was tired of checking all websites?) Also, links to websites that are for creative purpose (like YouTube) are allowed - despite not being as moderated as Scratch is. And what's the difference? Is it because it's an external website? I can understand that you need to moderate, but "providing another means for people to...
...communicate" is a strong phrase th
// ==UserScript==
// @name Don't Load Project
// @description Do not load project when reading comments
// @author apple502j
// @match https://scratch.mit.edu/projects/*
// ==/UserScript==
// Credit to Florrie
const destroyGUI = () => {
const oldMap = Array.prototype.map;
class Scratch3FaceSensingBlocks {
constructor (runtime) {
/**
* The runtime instantiating this block package.
* @type {Runtime}
*/
this.runtime = runtime;
this.runtime.emit('EXTENSION_DATA_LOADING', true);
Blazeface.load().then(model => {
this.blazeface = model;