Skip to content

Instantly share code, notes, and snippets.

@cheshirewara
cheshirewara / KeyboardSafeView.jsx
Created June 14, 2021 04:04 — forked from shunwitter/KeyboardSafeView.jsx
Temporary replacement with KeyboardAvoidingView
import React, { useRef, useState, useEffect } from 'react';
import {
Keyboard, Dimensions, Animated, ViewPropTypes,
} from 'react-native';
import { node } from 'prop-types';
export default function KeyboardSafeView({ children, style }) {
const initialViewHeight = useRef(null);
const animatedViewHeight = useRef(null);
const [viewHeight, setViewHeight] = useState(null);
function New-PSCredential( $ID, $PlainPassword ){
$SecurePassword = ConvertTo-SecureString –String $PlainPassword –AsPlainText -Force
$Credential = New-Object System.Management.Automation.PSCredential($ID, $SecurePassword)
Return $Credential
}
@cheshirewara
cheshirewara / gist:298472a018a550e21cc3560fec066be2
Created June 28, 2019 00:22
Cocoonフッターボタンカスタマイズ
<?php //モバイル用のスライドインボタンメニューの表示
/**
* Cocoon WordPress Theme
* @author: yhira
* @link: https://wp-cocoon.com/
* @license: http://www.gnu.org/licenses/gpl-2.0.html GPL v2 or later
*/
if ( !defined( 'ABSPATH' ) ) exit;
if (is_mobile_button_layout_type_slide_in()): ?>
var superpwa_sw = {"url":"/serviceWorker.js"};
if ('serviceWorker' in navigator) {
window.addEventListener('load', function() {
navigator.serviceWorker.register(superpwa_sw.url)
.then(function(registration) { console.log('PWA service worker ready'); registration.update(); })
.catch(function(error) { console.log('Registration failed with ' + error); });
});
}
@cheshirewara
cheshirewara / ページ遷移
Created August 7, 2018 17:04
ページ遷移PHP
<div id="fadeout" class="fadeout"></div>
<div id="loader" class="loader">
<p>
<span class="loading02"><span></span></span>
</p>
<p>
<span class="loading47"><span></span></span>
</p>
</div>
@cheshirewara
cheshirewara / ページ遷移
Created August 7, 2018 17:03
ページ遷移アニメーション
/////////////////////////////////////
// ページ遷移アニメーション
////////////////////////////////////
var speed = 500;
// ロード前
$(document).ready(function(){$('div#fadeout,div#loader').fadeOut(speed);});
// 遷移時の処理
// 前処理定義
function preProvess(){
@cheshirewara
cheshirewara / Youtube
Created August 1, 2018 01:35
Youtube動画直リンク(悪用禁止
javascript:var url = "https://www.youtube.com/get_video_info?video_id="+(document.location.href).split("=")[1];request = new XMLHttpRequest();request.addEventListener("load", (event) => {console.log(event.target.status);if(event.target.status === 200){console.log("sucssess request");res = event.target.responseText;srcArr = decodeURIComponent(res.split("&").filter(s => s.split("=")[0] === "url_encoded_fmt_stream_map")[0].split("=")[1]).split(",").map(v => v.split("&").filter(s => s.split("=")[0] == "url")[0].split("=")[1]);srcArr.filter(v=>console.log(decodeURIComponent(v)));src = decodeURIComponent(srcArr[0]);window.open(src);}});request.open("GET", url);request.send();undefined;
@cheshirewara
cheshirewara / カエレバpart2
Created August 1, 2018 01:34
カエレバ「画像リンク(Amazon)」の画像タグサイズ指定およびキャプション設定(wordpress向け)とクリップボードコピー
javascript:var div = document.createElement('div');div.style.display = 'none';div.innerHTML = document.getElementById('imgafilinkcode').getElementsByTagName('textarea')[0].value;var img = div.getElementsByTagName('img')[0];img.height = img.height;img.width = img.width;document.getElementById('imgafilinkcode').getElementsByTagName('textarea')[0].value = '[caption id="" align="alignnone" width="' + img.width + '"]' + div.innerHTML.replace(/&amp;/g,"&") + ' ※画像はAmazonリンク[/caption]';document.getElementById('imgafilinkcode').getElementsByTagName('textarea')[0].select();document.execCommand("copy");undefined;
@cheshirewara
cheshirewara / カエレバpart1
Created August 1, 2018 01:33
カエレバ「画像+リンクリスト」の画像タグサイズ指定およびクリップボードコピーブックマークレット
javascript:var div = document.createElement('div');div.style.display = 'none';div.innerHTML = document.getElementById('linkcode').getElementsByTagName('textarea')[0].value;var img = div.getElementsByClassName('kaerebalink-image')[0].children[0].children[0];img.height = img.height;img.width = img.width;document.getElementById('linkcode').getElementsByTagName('textarea')[0].value = div.innerHTML;document.getElementById('linkcode').getElementsByTagName('textarea')[0].select();document.execCommand("copy");undefined;