Month: October 2017

PHP: 通过字母大小写分割字符,大写字符分割到数组, php explode at capital letters?

I have strings like, $a = 'helloMister'; $b = 'doggyWaltz'; $c = 'bumWipe'; $d = 'pinkNips'; How can I explode at the capital letters, search on google for some time and came back with nothing! Thanks. 解决: If you want to split helloMister into hello and Mister you can use preg_split to split the string at a point just before the uppercase letter

Mysql: 格式化日期, 时间戳到日期, Convert timestamp to date in MySQL query

定义和用法 DATE_FORMAT() 函数用于以不同的格式显示日期/时间数据。 语法 DATE_FORMAT(date,format) date 参数是合法的日期。format 规定日期/时间的输出格式。 实例 下面的脚本使用 DATE_FORMAT() 函数来显示不同的格式。我们使用 NOW() 来获得当前的日期/时间: DATE_FORMAT(NOW(),'%b %d %Y %h:%i %p') DATE_FORMAT(NOW(),'%m-%d-%Y') DATE_FORMAT(NOW(),'%d %b %y') DATE_FORMAT(NOW(),'%d %b %Y %T:%f') 结果类似: Dec 29 2008 11:45 PM 12-29-2… Read More

获取访问者的IP, 定位访问中IP,Geoip DB

How to use? Geoip-db.com allows you to find out the geographic location of your website’s visitor by IP address. Easily identify the location, country, city, hostname, network owner and other characteristics of your Internet users by using one of our services. We provide two kind of services, either a JSON-object or JSONP callback function is retu…

添加holiday假日到fullcalendar ,Add Holiday Calendars to Full Calendar

如果你使用fullcalendar,添加holiday假日的方法如下: googleCalendarApiKey : 'PUT-YOUR-GOOGLE-API-HERE', // google api key eventSources: [ {url:'https://www.google.com/calendar/feeds/en.usa#holiday@group.v.calendar.google.com/public/basic',cache:true}, // us holiday {url:'https://www.google.com/calendar/feeds/zh.china#holiday@grou… Read More

改造FullCalendar增加节气、节日和农历显示, add lunar for FullCalendar

网上看了FeiFei些的《fullCalendar改造计划之带农历节气节假日的万年历》文章,按照他的方法改造发现他用的是老版本的插件,新版本代码结构变动很大,无奈自己重新读源码改造之,记录下来,给有需求的朋友一点参考。 FullCalendar官网(https://fullcalendar.io/) 改造使用新的版本,v 3.0.1。 首先看下改造成功后的预览图吧: 一、汉化 现在插件已经自带了本地化文件,所以直接加载插件包中的locale/zh-cn/js即可。 二、增加农历,节气,节假日显示 关于直接调用Google Calendar的订阅我就不说了,墙的厉害。 下面说说直接修改源文件,这个就麻烦点,不过自定… Read More

创建Google API Key, Creating a Google API Key

To read events from your public Google Calendars you’ll need create a Google API key and save within your plugin settings. Here are step-by-step instructions to create and save a Google API key: 1Navigate to the Google Developers Console. 2 From the top Project menu select Create project. 3Give your project a name, agree to the terms, then click Create. 4…

JQuery: 提交表单数据,转换表单数据为json,values of Form to Json (jquery.serializeJSON)

项目:https://github.com/marioizquierdo/jquery.serializeJSON 下载:jquery.serializeJSON-master jquery.serializeJSON 前端在处理含有大量数据提交的表单时,除了使用Form直接提交刷新页面之外,经常碰到的需求是收集表单信息成数据对象,Ajax提交。 而在处理复杂的表单时,需要一个一个区手动判断处理字段值,显得非常麻烦。接下来介绍的插件将解决这个问题。 使用jquery.serializeJSON,可以在基于jQuery或者Zepto的页面中,调用 .serializeJSON() 方法来序列化form表单… Read More

JavaScript 日期处理类库: Moment.js 写法示例(详解)

主页:http://momentjs.cn/ 文档:http://momentjs.cn/docs/ 项目地址:https://github.com/moment/moment/ 下载:moment-develop 引用: http://sources.ikeepstudying.com/js/moment-2.10.6.js  (未压缩) http://sources.ikeepstudying.com/js/moment.min-2.18.1.js (压缩版) http://sources.ikeepstudying.com/js/moment-with-locales-2.10.6.js (支持多语言) &… Read More

PHP: 遍历出两个时间之间的日期 Date function to display all dates between two dates

There is the DatePeriod class. EXAMPLE: $begin = new DateTime('2013-02-01'); $end = new DateTime('2013-02-13'); $daterange = new DatePeriod($begin, new DateInterval('P1D'), $end); foreach($daterange as $date){ echo $date->format("Y-m-d") . "<br>"; } (P1D stands for period of one day, see DateInterval for further documentation) $pe… Read More

Javascript: JS函数节流与防抖 throttle,debounce

throttle 与 debounce 都是为了限制函数的执行频次,以优化函数触发频率过高导致的响应速度跟不上触发频率,出现延迟,假死或卡顿的现象。 概念 throttle:连续的时间间隔(每隔一定时间间隔执行callback)。 debounce:空闲的时间间隔(callback执行完,过一定空闲时间间隔再执行callback)。 电梯超时 想象每天上班大厦底下的电梯。把电梯完成一次运送,类比为一次函数的执行和响应。假设电梯有两种运行策略 throttle 和 debounce ,超时设定为15秒,不考虑容量限制。 throttle 策略的电梯。保证如果电梯第一个人进来后,15秒后准时运送一次,不等待。如果没有人,则待… Read More

PHP 网页爬虫:Simple HTML DOM解析器使用入门 (web crawler)

  下载地址:https://github.com/samacs/simple_html_dom 文档地址 http://simplehtmldom.sourceforge.net/ 中文手册:http://microphp.us/plugins/public/microphp_res/simple_html_dom/manual.htm 下载:simplehtmldom_1_5 一直以来使用php解析html文档树都是一个难题。Simple HTML DOM parser 帮我们很好地解决了使用 php html 解析 问题。可以通过这个php类来解析html文档,对其中的html元素进行操作 (PHP5+以… Read More

Java日期简化工具Joda Time

英文官方文档:http://www.joda.org/joda-time/userguide.html 简介 想必大家在平时的项目开发中经常要处理日期的问题,比如需要处理两个日期间隔的天数,使用JDK1.8以前自带的日期API处理相当的繁琐(JDK1.8的API已经重写了日期库,其实也是借鉴了Joda-Time),那么接下来介绍的这款日期库工具(Joda-Time)就非常强大了,使用Joda-Time可以轻松的处理各种复杂的时间相关问题。 特点 易于使用:使用Joda-Time可以非常容易的处理一些复杂的日期问题 易于扩展:Joda-Time支持多达8种日历系统 线程安全:Joda类具有不可变性,因此它们… Read More