Skip to content

Instantly share code, notes, and snippets.

@mly520
mly520 / .js
Last active September 10, 2018 00:17
javascript 関数
String.prototype.before = function(word, include){
var idx = this.indexOf(word)
var l = include ? word.length : 0
return idx >= 0 ?
this.substr(0, idx + l) :
""
}
String.prototype.after = function(word, include){
var idx = this.indexOf(word)
var l = include ? 0 : word.length
@mly520
mly520 / new_to_mqtt.rst
Created July 17, 2018 00:32 — forked from voluntas/new_to_mqtt.rst
初めての MQTT
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* KAI eCRM
*
* 画像操作クラス
*
* @package application
* @author an
* @version 1.0α
* @filesource
@mly520
mly520 / number_to_zhongwen.php
Created August 25, 2013 11:54
php 数字转换汉字
test2();
/**
* 方法测试
*/
function test2() {
echo IntToCn(333030); // 三十三万三千零三十
echo IntToCn(1111); // 一千一百一十一
echo IntToCn(101010101); // 一亿一百零一万零一百零一
}
@mly520
mly520 / php-session
Created August 25, 2013 10:28
php-session
1 什么是会话控制
出现原因:http是无状态协议的,每次都是不同的服务器请求,无法维护两个请求事务之间的关系.
会话控制:能够在网站中跟踪一个变量,通过对变量的跟踪,就可以使多个请求事物之间建立联系,根据授权和用户身份显示不同的内容,不同页面
cookie:是服务器设置在客户端的文本文件,保存客户端得个人信息.
2 会话跟踪技术
1 隐藏表单域
2 url重写
3 cookie技术
4 session技术
@mly520
mly520 / .htaccess でproxy
Created November 12, 2013 03:13
httpd.conf で proxy(URL書き替え)
ProxyRequests Off
ProxyPreserveHost On
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass /EMBackend http://localhost:8080/backend/mvc
ProxyPassReverse /EMBackend http://localhost:8080/backend/mvc
@mly520
mly520 / Lsyncd 監視対象ファイルの上限
Created October 11, 2013 02:03
Lsyncd 監視対象ファイルの上限
Lsyncdが利用している inotifyが監視できるファイル数には上限があります。
この上限を超えると、Lsyncdは動作を停止 or 起動してくれません。
起動しようとすると、こんなエラーが発生します。(しました)
lsyncd: Error, Terminating since out of inotify watches.#012Consider increasing /proc/sys/fs/inotify/max_user_watches
ちなみに、上限値は以下で確認できます。
@mly520
mly520 / jquery-css-selector
Last active December 22, 2015 22:09
jquery-css-selector
さて前回jQueryをダウンロードしましたが、今回は実際にjQueryを使う際に必要になる基本セレクタについてを勉強します。
まずセレクタとは何なのかを簡単に説明します。
下記のようなHTMLがあったとします。
<html>
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<title>jQueryを使ってみよう。(基本編 セレクタ1)</title>
<script type="text/javascript" src="../jquery-1.2.6.min.js"></script>
@mly520
mly520 / jquery-sparkline.js
Last active December 22, 2015 07:19
jquery sparkline pie sparkline
$(".sparkline.pie_week").sparkline([1, 1, 2], {
type: 'pie',
width: '400',
height: '400',
enableTagOptions: true,
tooltipFormat: '<span style="color: {{color}}">&#9679;</span> {{offset:names}} ({{percent.1}}%)',
tooltipValueLookups: {
names: {
0: 'one',
1: 'two',
@mly520
mly520 / ssl-install
Created August 26, 2013 12:02
centos ssl 設定例 localのみ
■mod_sslインストール[root@centos ~]# yum -y install mod_ssl ← mod_sslインストール
■WebサーバーSSL設定(1)サーバー用秘密鍵・証明書作成[root@centos ~]# cd /etc/pki/tls/certs/ ← ディレクトリ移動
[root@centos certs]# sed -i 's/365/3650/g' Makefile ← サーバー用証明書有効期限を1年から10年に変更
[root@centos certs]# make server.crt ← サーバー用秘密鍵・証明書作成
umask 77 ; \
/usr/bin/openssl genrsa -des3 1024 > server.key
Generating RSA private key, 1024 bit long modulus