Skip to content

Instantly share code, notes, and snippets.

View williamherry's full-sized avatar

William Herry williamherry

View GitHub Profile
open(selectedDates, dateStr, instance) {
this.hotfix();
}
monthChange(selectedDates, dateStr, instance) {
this.hotfix();
}
yearChange(selectedDates, dateStr, instance) {
this.hotfix();
@williamherry
williamherry / hubot-explore.md
Last active April 1, 2016 16:24
Hubot Explore

安装

Hubot需要Node和npm的比较新的版本,Mac os x安装非常简单,从nodejs.org下载安装就可以了

➜  node --version
v0.12.4
➜ npm --version
# Description:
# Example scripts for you to examine and try out.
#
# Notes:
# They are commented out by default, because most of them are pretty silly and
# wouldn't be useful and amusing enough for day to day huboting.
# Uncomment the ones you want to try and experiment with.
#
# These are from the scripting documentation: https://github.com/github/hubot/blob/master/docs/scripting.md
@williamherry
williamherry / bearychat-webhook.coffee
Last active April 2, 2016 14:46
集成到倍洽(bearychat)的hook代码
{TextMessage} = require '../node_modules/hubot/src/message'
module.exports = (robot) ->
robot.router.post '/hubot/bearychat/:room', (req, res) ->
data = if req.body.payload? then JSON.parse req.body.payload else req.body
robot._send ?= robot.adapter.send;
robot.adapter.send = (user,strings...) ->
res.send {text: strings.toString()} if user.user.name is "http"
robot.adapter.send = robot._send if user.user.name isnt "http"
{
"name": "qiniu-js-sdk",
"version": "0.0.1",
"description": "Qiniu JavaScript SDK Node Module",
"main": "qiniu.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
check process redis-server
with pidfile "/var/run/redis.pid"
start program = "/etc/init.d/redis-server start"
stop program = "/etc/init.d/redis-server stop"
if 2 restarts within 3 cycles then timeout
if totalmem > 100 Mb then alert
if children > 255 for 5 cycles then stop
if cpu usage > 95% for 3 cycles then restart
if failed host 127.0.0.1 port 6379 then restart
if 5 restarts within 5 cycles then timeout
undefined method `[]=' for Sidekiq:Module
/home/deploy/rails_apps/smart_lion/releases/20140326083837/config/initializers/sidekiq.rb:13:in `block in <top (required)>'
/home/deploy/rails_apps/smart_lion/shared/bundle/ruby/2.0.0/gems/sidekiq-2.17.0/lib/sidekiq.rb:47:in `configure_server'
/home/deploy/rails_apps/smart_lion/releases/20140326083837/config/initializers/sidekiq.rb:3:in `<top (required)>'
/home/deploy/rails_apps/smart_lion/shared/bundle/ruby/2.0.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:223:in `load'
/home/deploy/rails_apps/smart_lion/shared/bundle/ruby/2.0.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:223:in `block in load'
/home/deploy/rails_apps/smart_lion/shared/bundle/ruby/2.0.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:214:in `load_dependency'
/home/deploy/rails_apps/smart_lion/shared/bundle/ruby/2.0.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:223:in `load'
/home/deploy/rails_apps/smart_lion/shared/bundle/ruby/2.0.0/gems/rai
payload | duration | started_at
-----------------------------------------------------------------------------------+----------------+------------------------
{"class":"PushService","jid":"2ff704a149d4c74d3f225492","notification_count":200} | 5770.233193 | 2014-03-12 10:00:16+08
{"class":"PushService","jid":"bb1369d665db8931fd63e716","notification_count":200} | 20513.497832 | 2014-03-12 10:02:15+08
{"class":"PushService","jid":"29f47a69907044060579206c","notification_count":200} | 4035.010939 | 2014-03-12 10:04:15+08
{"class":"PushService","jid":"1c3d7f4ae405903fe5839abd","notification_count":200} | 54542.827837 | 2014-03-12 10:06:15+08
{"class":"PushService","jid":"0fcb6888c08ed51b41b94eb6","notification_count":200} | 143353.947749 | 2014-03-12 10:08:15+08
{"class":"PushService","jid":"b3e6b84b95d0683b593fa2bf","notification_count":200} | 50347.900462 | 2014-03-12 10:12:15+08
{"class":"PushService","jid"
# app / controllers / application_controller.rb
class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
before_filter :configure_permitted_parameters, if: :devise_controller?
protected
def configure_permitted_parameters
@williamherry
williamherry / tinyssh.erl
Created November 14, 2012 15:55
tinyssh erlang
-module(tinyssh).
-export([upload_download/1]).
-export([run_cmd/1]).
-export([download/3]).
-export([upload/3]).
-export([run_action/7]).
-export([run_action/6]).
-export([run/2]).