Skip to content

Instantly share code, notes, and snippets.

@developerworks
developerworks / mod_system_information.erl
Created October 4, 2014 12:12
mod_system_information.erl
%%%----------------------------------------------------------------------
%%% File : mod_onlineusers.erl
%%% Author : Michael Weibel <michael.weibel@amiadogroup.com>
%%% Purpose : Display number of online users
%%% Created : 2011-08-16
%%%----------------------------------------------------------------------
%%% https://github.com/candy-chat/mod_onlineusers
%%% http://blog.zlxstar.me/blog/2013/07/21/dicorvery-user-muclist
@developerworks
developerworks / register_jquery.min.js
Created October 3, 2014 12:42
Register user with strophe.js and strophe.register.js plugin.
/*
* jQuery 1.2.6 - New Wave Javascript
*
* Copyright (c) 2008 John Resig (jquery.com)
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
* $Date: 2008/05/26 $
* $Rev: 5685 $
*/
/* global Application, ObjC, $ */
/**
* repozish.js
*
* this is an example of using os x yosemite's "JavaScript for Automation":
*
* https://developer.apple.com/library/prerelease/mac/releasenotes/interapplicationcommunication/rn-javascriptforautomation/index.html
*
* it repositions some windows based on some position settings. you can run
@developerworks
developerworks / mod_muc_member_list.erl
Created September 29, 2014 19:21
Ejabberd module: get room members
%% 参考资源
%% https://www.ejabberd.im/node/4159?q=node/4159
%% http://blog.zlxstar.me/blog/2013/07/21/dicorvery-user-muclist/
-module(mod_muc_member_list).
-author('hezhiqiang').
-behaviour(gen_mod).
-include("ejabberd.hrl").
-include("jlib.hrl").
-include("logger.hrl").
-define(NS_MUC_MEMBER_LIST, <<"http://jabber.org/protocol/muc#member-list">>).
@developerworks
developerworks / basic.html
Created September 29, 2014 16:48
Strophe.js Client Code
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta http-equiv="Content-Language" content="zh-CN"/>
<title>Strophe.js Basic Example</title>
<script src='jquery.min.js'></script>
<script src='../strophe.js'></script>
<script src='basic.js'></script>
<script src="basic_lab.js"></script>
###
### ejabberd configuration file
###
###
### The parameters used in this configuration file are explained in more detail
### in the ejabberd Installation and Operation Guide.
### Please consult the Guide in case of doubts, it is included with
### your copy of ejabberd, and is also available online at
### http://www.process-one.net/en/ejabberd/docs/
# How to echobot with XMPP, BOSH, and Strophe
1. Setup ejabberd(http://www.ejabberd.im/) server and setup account admin@localhost.local
NOTE: localhost should be enough. If you setup something else, make sure you add it at /etc/hosts like this
#/etc/hosts
127.0.0.1 localhost.local
NOTE: Also download Psi(http://psi-im.org/), and make sure you can connect to your ejabberd server.
2. Download strophe(http://code.stanziq.com/strophe/) and place it (eg: /Users/makoto/work/sample/strophejs-1.0)
<body xmlns="http://jabber.org/protocol/httpbind"
sid="e0408bf8d86f0a7f44afda59aa8f81b75d029bb6"
wait="60"
requests="2"
inactivity="30"
maxpause="120"
polling="2"
ver="1.6"
from="ymc-pg-ejabberd"
secure="true"
@developerworks
developerworks / console-admin-server.upstart.conf
Created August 26, 2014 02:55
Ubuntu Upstart Configuration for Node.js Forever
author "hezhiqiang"
description "Console Admin Server"
start on runlevel [2345]
stop on starting rc RUNLEVEL=[016]
expect fork
env NODE_BIN_DIR="/usr/local/bin"
env NODE_PATH="/usr/local/lib/node_modules"
@developerworks
developerworks / androidpn.upstart.conf
Created August 26, 2014 02:52
Android Push Server Upstart Configuration File
author "hezhiqiang"
description "Android Push Server"
start on runlevel [3]
stop on starting rc RUNLEVEL=[016]
respawn
respawn limit 10 5
expect fork
env BASEDIR=/opt/androidpn-server-bin-jetty
env CLASSPATH=$BASEDIR/conf
env LOG=$BASEDIR/logs/androidpn.log