Skip to content

Instantly share code, notes, and snippets.

View fraserxu's full-sized avatar
🐢
No idea

Fraser Xu fraserxu

🐢
No idea
View GitHub Profile
Removing write permissions of /usr/local/bin and /usr/local directories resolved this issue.
chmod go-w /usr/local/bin
sudo chmod go-w /usr/local
@fraserxu
fraserxu / wiredcraft_logo
Created March 17, 2014 11:45
wiredcraft logo
@fraserxu
fraserxu / octochat
Last active August 29, 2015 13:57
Commands need to run to start develop on Octochat
####### Octochat Client
$ cd client
$ grunt dev && grunt live
####### Vagrant box
# restart nginx
$ sudo service nginx restart
@fraserxu
fraserxu / ejabberd
Created March 19, 2014 08:17
ejabberd.log
2014-03-19 08:16:08.044 [critical] <0.10367.45>@extauth:loop:146 extauth script has exitted abruptly with reason 'normal'
2014-03-19 08:16:08.047 [critical] <0.10368.45>@extauth:loop:146 extauth script has exitted abruptly with reason 'normal'
2014-03-19 08:16:08.051 [critical] <0.10369.45>@extauth:loop:146 extauth script has exitted abruptly with reason 'normal'
2014-03-19 08:16:08.054 [critical] <0.10370.45>@extauth:loop:146 extauth script has exitted abruptly with reason 'normal'
2014-03-19 08:16:08.057 [critical] <0.10371.45>@extauth:loop:146 extauth script has exitted abruptly with reason 'normal'
2014-03-19 08:16:08.061 [critical] <0.10372.45>@extauth:loop:146 extauth script has exitted abruptly with reason 'normal'
2014-03-19 08:16:08.063 [critical] <0.10373.45>@extauth:loop:146 extauth script has exitted abruptly with reason 'normal'
2014-03-19 08:16:08.070 [critical] <0.10374.45>@extauth:loop:146 extauth script has exitted abruptly with reason 'normal'
2014-03-19 08:16:08.075 [critical] <0.10375.45>@
@fraserxu
fraserxu / ejabberd
Created March 19, 2014 08:28
ejabberd.log
2014-03-19 08:27:40.362 [debug] <0.7506.48>@ejabberd_c2s:send_text:1507 Send XML on stream = "</stream:stream>"
2014-03-19 08:27:40.367 [info] <0.6322.48>@ejabberd_listener:accept:279 (#Port<0.1590479>) Accepted connection {{172,17,0,3},38554} -> {{192,168,55,44},5222}
2014-03-19 08:27:40.368 [debug] <0.7507.48>@ejabberd_receiver:process_data:321 Received XML on stream = "<stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" version="1.0" to="fraser-test.octochat.local">"
2014-03-19 08:27:40.368 [info] <0.6322.48>@ejabberd_listener:accept:279 (#Port<0.1590481>) Accepted connection {{172,17,0,2},33909} -> {{192,168,55,44},5222}
2014-03-19 08:27:40.368 [debug] <0.7508.48>@ejabberd_c2s:send_text:1507 Send XML on stream = [60,63,120,109,108,32,118,101,114,115,105,111,110,61,39,49,46,48,39,63,62,60,115,116,114,101,97,109,58,115,116,114,101,97,109,32,120,109,108,110,115,61,39,106,97,98,98,101,114,58,99,108,105,101,110,116,39,32,120,109,108,110,115,58,115,116,114,101,97,109,61,39,104,1
@fraserxu
fraserxu / ejabberd
Created March 19, 2014 09:01
ejabberd.log
packet {xmlel,<<"presence">>,[{<<"xml:lang">>,<<>>},{<<"to">>,<<"all@muc.fraser-test.octochat.local/bot">>}],[{xmlel,<<"x">>,[{<<"xmlns">>,<<"http://jabber.org/protocol/muc">>}],[{xmlel,<<"history">>,[{<<"seconds">>,<<"1">>}],[]}]}]}
2014-03-19 09:00:31.992 [debug] <0.27560.68>@mod_muc:start_new_room:548 MUC: open new room 'all'
2014-03-19 09:00:32.016 [info] <0.27566.68>@mod_muc_room:init:203 Created MUC room all@muc.chattest.octochat.local by bot@chattest.octochat.local/32801785511395219631615292
2014-03-19 09:00:32.017 [debug] <0.27554.68>@ejabberd_router:do_route:222 route
from {jid,<<"bot">>,<<"chattest.octochat.local">>,<<"32801785511395219631615292">>,<<"bot">>,<<"chattest.octochat.local">>,<<"32801785511395219631615292">>}
to {jid,<<"all">>,<<"muc.chattest.octochat.local">>,<<>>,<<"all">>,<<"muc.chattest.octochat.local">>,<<>>}
packet {xmlel,<<"iq">>,[{<<"xml:lang">>,<<>>},{<<"to">>,<<"all@muc.chattest.octochat.local">>},{<<"type">>,<<"set">>},{<<"id">>,<<"create1">>}],[{xmlel,<<"query">>,[{<<"xml
function Animal(name) {
if (!(this instanceof Animal)) return new Animal(name);
this.name = name || 'unknown';
}
module.exports = Animal;
Animal.prototype.feed = function(food) {
food = food || 'food';
return 'Fed ' + this.name + ' some ' + food;
};
@fraserxu
fraserxu / directive.js
Last active August 29, 2015 14:01
A simple angularjs directive to open a link with system map client
app.directive('mapScheme', function($window) {
return {
restrict: 'A',
link: function(scope, element, attr) {
if (attr.mapScheme != null) {
element.on('click', function() {
$window.open(encodeURI(attr.mapScheme), '_system', 'location=no');
});
}
}
@fraserxu
fraserxu / index.jade
Last active August 29, 2015 14:01
async load google map api demo
doctype html
html(lang="en")
head
title Map App
body(ng-app="mapApp" animation="slide-left-right-ios7")
ion-nav-bar.bar-light.shadow
ion-nav-view(id="main")
//- use init-map directive here
@fraserxu
fraserxu / isInArea.coffee
Created July 1, 2014 08:42
A function to calculate if a geo point is in a cirlce
###*
* Check if a given point in a circle
* @param {Object} circle a cirle object with radius and center point
* @param {Object} point a point need to be checked
* @return {Boolean} True or False
###
Map.isInArea = (circle, point) ->
getDistance = (lng1, lat1, lng2, lat2) ->
# Radisu of the erath in km
R = 6371