Skip to content

Instantly share code, notes, and snippets.

@nobodyplace
nobodyplace / index.class.php
Last active January 29, 2022 11:19
Smartyでファイルの更新日時を付与する動的プラグイン
<?php
class Index
{
public function __construct()
{
$smarty->registerPlugin('function', 'filemtime', array($this, 'smarty_function_filemtime'));
}
public function smarty_function_filemtime($params, $smarty)
{
$file = $params['file'];
@nobodyplace
nobodyplace / DisplayManager.class.php
Last active January 30, 2022 00:04
Smartyでファイルの更新日時を付与する動的プラグイン
<?php
class DisplayManager
{
function __construct()
{
$this->_smarty->registerPlugin('function', 'filemtime', array($this, 'smarty_function_filemtime'));
}
public function smarty_function_filemtime($params, $smarty)
{
@nobodyplace
nobodyplace / qt.insertContent.js
Created January 14, 2022 09:37
quicktag.jsからの抜粋
qt.insertContent = function(content) {
var sel, startPos, endPos, scrollTop, text, canvas = document.getElementById(wpActiveEditor), event;
if ( !canvas ) {
return false;
}
if ( document.selection ) { //IE
canvas.focus();
sel = document.selection.createRange();
@nobodyplace
nobodyplace / wordpress_create_list_button.js
Last active January 14, 2022 10:18
Wordpressで一発でリスト作成するためのボタン用コールバック関数
QTags.addButton('qt-ul','ul',function() {
canvas = document.getElementById(wpActiveEditor);
text = canvas.value;
startPos = canvas.selectionStart;
endPos = canvas.selectionEnd;
scrollTop = canvas.scrollTop;
content = text.substring(startPos, endPos);
//リスト加工
content = '<ul>\n'
+ content.split(/\n/)
$.post({
url: 'makecsv.php',
dataType: 'json',
data: {
data: data
}
}).done(function(response){
if(response != ''){
let uInt8List;
let code = $('#result-output-encode').val();
<?php
class makeCsv
{
public function arrangeData()
{
try {
//サンプルデータ
//$_POST['data']
$post_data = [
['お客様ID', '購入金額', '購入日付'],
@nobodyplace
nobodyplace / nico_player_bookmarklet_ex.js
Last active April 26, 2021 17:21
ニコニコ動画 プレイヤー埋め込みコード ブックマークレット(展開)
javascript:
var a = location.href.match(/watch\/([^\/]+)/)[1];
var t = document.title.replace(/ - ニコニコ動画/,'');
var l='<script type="application/javascript" src="https://embed.nicovideo.jp/watch/'+a+'/script?w=720&h=480"></script><noscript><a href="https://www.nicovideo.jp/watch/'+a+'">'+t+'</a></noscript>';
prompt("code",l);
void(0);
@nobodyplace
nobodyplace / nico_player_bookmarklet.js
Last active April 26, 2021 17:21
ニコニコ動画 プレイヤー埋め込みコード ブックマークレット
javascript:var a = location.href.match(/watch\/([^\/]+)/)[1];var t = document.title.replace(/ - ニコニコ動画/,'');var l='<script type="application/javascript" src="https://embed.nicovideo.jp/watch/'+a+'/script?w=720&h=480"></script><noscript><a href="https://www.nicovideo.jp/watch/'+a+'">'+t+'</a></noscript>';prompt("code",l);void(0);
@nobodyplace
nobodyplace / create_and_download.html
Last active August 5, 2021 11:11
JavaScriptでデータからCSVファイルを生成しダウンロードさせる
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>JavaScriptでデータからCSVファイルを生成しダウンロードさせる</title>
<meta charset="utf-8">
</head>
<body>
<button type="button" onClick="createAndDownloadCsv()">CSVダウンロード</button>
<script>
<?php
$client = new \GuzzleHttp\Client();
$res = $client->post(
'https://hoge/issues.json',
[
'json' => [
'key' => $api_key
,'issue' => [
'project_id' => 1
,'subject' => '題名サンプル'