Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Hori Godai steelydylan

🎯
Focusing
Block or report user

Report or block steelydylan

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@steelydylan
steelydylan / use-scrolling.ts
Created Jun 27, 2019
Windowのスクロール状態を監視するためのReact hooks
View use-scrolling.ts
export const useScrolling = (delay: number) => {
const [scrolling, setScrolling] = useState(false);
useEffect(() => {
let debounceTimer = null;
const eventHandler = () => {
if (scrolling === false) {
setScrolling(true);
}
clearTimeout(debounceTimer);
debounceTimer = setTimeout(() => {
@steelydylan
steelydylan / tooltip.tsx
Created May 30, 2019
ツールチップのマウスオーバーマウスリーブ、よく使うからメモ!
View tooltip.tsx
hoverOnCropList = () => {
clearTimeout(this.state.timeout);
this.setState({
isCropListOpen: true
});
}
leaveFromCropList = () => {
const timeout = setTimeout(() => {
@steelydylan
steelydylan / Hook.php
Created May 15, 2019
ブログレベルを表示するグローバル変数の生成サンプル
View Hook.php
<?php
namespace Acms\Custom;
use DB;
use SQL;
use ACMS_Filter;
/**
* ユーザー定義のHookを設定します。
*/
@steelydylan
steelydylan / conditional-wrap.tsx
Created Feb 6, 2019
ConditionalWrapComponent
View conditional-wrap.tsx
import * as React from 'react';
interface ConditionalWrapType{
condition: boolean,
wrap: (children) => React.ReactNode
children: React.ReactNode
}
export default ({condition, wrap, children}): React.SFCElement<ConditionalWrapType> => condition ? wrap(children) : children;
@steelydylan
steelydylan / global.d.ts
Created Dec 14, 2018
もともとglobalに出ているjsライブラリをTypeScriptで定義しておく方法
View global.d.ts
import { XmlData } from './type';
declare global {
namespace JKL {
class ParseXML {
constructor(path: string)
parse(): XmlData
}
}
}
@steelydylan
steelydylan / field.html
Last active Oct 18, 2018
a-blog cms のカスタムフィールドでyahooMapを利用する
View field.html
<table class="formColumnMap js-yahoo-map">
<tr>
<td class="formColumnMapTd">
<!-- BEGIN_IF [%{PROTOCOL}/eq/https] -->
<img class="column-map js-map_editable-container" src="//map.yahooapis.jp/map/V1/static?appid=%{YAHOO_API_KEY}&lat={mapLat}&lon={mapLng}&z={mapZoom}&width=400&height=400&pointer=on"
width="400" height="400">
<!-- ELSE -->
<img class="column-map js-map_editable-container" src="//map.olp.yahooapis.jp/OpenLocalPlatform/V1/static?appid=%{YAHOO_API_KEY}&lat={mapLat}&lon={mapLng}&z={mapZoom}&width=400&height=400&pointer=on"
width="400" height="400">
<!-- END_IF -->
@steelydylan
steelydylan / js.html
Last active Aug 10, 2018
a-blog cmsでjQueryの3系を利用したい場合
View js.html
<script
src="https://code.jquery.com/jquery-3.3.1.js"
integrity="sha256-2Kok7MbOyxpgUVvAk/HJ2jigOSYS2auK4Pfzbm7uH60="
crossorigin="anonymous"></script>
<script src="https://code.jquery.com/jquery-migrate-3.0.0.min.js" charset="UTF-8"></script>
<!-- BEGIN_MODULE Js -->
<script src="%{ROOT_DIR}acms.js{arguments}" charset="UTF-8" id="acms-js"></script><!-- END_MODULE Js -->
@steelydylan
steelydylan / app.js
Last active Jul 20, 2018
Harmoware-VIS 最小サンプル
View app.js
// app.js mapboxを使用する場合のサンプル
import React from 'react';
import {
Container, connectToHarmowareVis,
HarmoVisLayers, MovesLayer, DepotsLayer,
MovesInput, DepotsInput, SimulationDateTime,
PauseButton, ForwardButton, ReverseButton, AddMinutesButton,
ElapsedTimeRange, SpeedRange
} from 'harmoware-vis';
View content-load.js
export default (handler) => {
if (document.readyState === 'interactive' || document.readyState === 'complete') {
handler();
} else {
document.addEventListener('DOMContentLoaded', handler, false);
}
};
@steelydylan
steelydylan / example.js
Created May 25, 2018
jsonからランダムに動画を選んでdomに追加して再生するJavaScript
View example.js
import randomVideo from 'random-video';
randomVideo('#js-random-video', '/sample.json');
You can’t perform that action at this time.