Skip to content

Instantly share code, notes, and snippets.

Avatar
🤒
Out sick

周梦康 zhoumengkang

🤒
Out sick
View GitHub Profile
@zhoumengkang
zhoumengkang / netty.sh
Created Jul 20, 2015
netty 项目启动脚本
View netty.sh
#!/bin/bash
ps -ef|grep [h]ujia |awk '{printf "kill -9 %d",$2}'|sh
cd /xxx/hujia/
CLASSPATH="."
for jar in `ls ./lib`
do
CLASSPATH="$CLASSPATH:./lib/$jar"
done
@zhoumengkang
zhoumengkang / publish.sh
Last active Aug 29, 2015
代码上线控制代码 更加具体的说明http://mengkang.net/454.html
View publish.sh
#!/bin/sh
######################## config ########################
# 升级日志
publish_log_file="/update/log/path/publish.log"
# 需要邮件通知的人
master=(
i@zhoumengkang.com
View matchSize.php
// 先判定宽高比,再判定宽高
$sizeArr = explode("x", $p['screen']);
$screenWidth = $sizeArr['0'];
$screenHeight = $sizeArr['1'];
if ($screenHeight)
$wh = $screenWidth / $screenHeight;
$tmpArr = array();
// 根据 宽高比最小差值,宽最小差值,高最小差值 进行排序,顶部为最合适的尺寸
foreach ($splashArr as $info) {
View SplClassLoader.php
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
View send_request_by_fsockopen.php
<?php
function send_request_by_fsockopen($url,$post_data=array()){
$url_array = parse_url($url);
$hostname = $url_array['host'];
$port = isset($url_array['port'])? $url_array['port'] : 80;
$requestPath = $url_array['path'] ."?". $url_array['query'];
$fp = fsockopen($hostname, $port, $errno, $errstr, 10);
if (!$fp) {
echo "$errstr ($errno)";
return false;
@zhoumengkang
zhoumengkang / cache.php
Last active Aug 29, 2015
练习:用mysql建一张表来模拟memcache做缓存操作类,要求用到工厂模式,单件模式,适配器模式
View cache.php
<?php
class Cache
{
private static $instance = array();
/**
* 缓存实例化的工厂方法并且确保单例
*/
public static function getInstance( $type,$options=array()){
$type = strtolower(trim($type));
@zhoumengkang
zhoumengkang / module.js
Last active Dec 21, 2015
ThinkSNS的自定义事件监听
View module.js
/****************************************************
* *
* Sociax HTML 标签关联模型 *
* *
****************************************************/
/**
* HTML 标签关联模型
* @model-node 模型节点的标签属性标记
* @event-node 模型下事件节点的标签属性标记
@zhoumengkang
zhoumengkang / wind.js
Created Jun 6, 2014
phpwind官方的wind.js
View wind.js
/*!
* HeadJS The only script in your <HEAD>
* Author Tero Piirainen (tipiirai)
* Maintainer Robert Hoffmann (itechnology)
* License MIT / http://bit.ly/mit-license
*
* Version 0.99
* http://headjs.com
*/
/* modify : head ==> Wind */
View weixin.php
<?php
/**
* description : null
* @author : zhoumengkang
* createTime : 15/2/14 10:12
*/
define("TOKEN", "weixin");
$wechatObj = new weChat();
class weChat{
View fsockopen.php
function fsockopen_test(){
$hostname = 'm.cn';
$url = '/bbb/2.php';
$fp = fsockopen($hostname, 80, $errno, $errstr, 5);
if (!$fp) {
echo "$errstr ($errno)";
return false;
}
$header = "GET $url HTTP/1.1\r\n";
$header.="Host: $hostname\r\n";
You can’t perform that action at this time.