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
@fraserxu
fraserxu / gist:8020199
Created December 18, 2013 10:27 — forked from riywo/gist:5000181
# branch
$ git branch -d BRANCH # delete local BRANCH
$ git push origin :BRANCH # delete remote BRANCH
# tag
$ git tag -d TAG # delete local TAG
$ git push origin :refs/tags/TAG # delete remote TAG
@fraserxu
fraserxu / textcomplete-wrapper.html
Created January 3, 2014 05:00
textcomplete-wrapper
<div class="textcomplete-wrapper" style="position: relative; display: inline-block;">
<ul class="dropdown-menu" style="position: absolute; bottom: 32px; left: 34px; z-index: 100;">
<li class="textcomplete-item active" data-index="0"><a>frankdou</a></li>
<li class="textcomplete-item" data-index="1"><a>fraserxu</a></li>
<li class="textcomplete-item" data-index="2"><a>kuno</a></li>
<li class="textcomplete-item" data-index="3"><a>xeodou</a></li>
</ul>
<textarea class="text ng-valid ng-dirty" ng-model="message" placeholder="Send a message" type="text" rows="1" ng-keypress="checkKeyCode($event)"></textarea>
</div>
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">>,<<"[email protected]/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 [email protected] by [email protected]/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">>,<<"[email protected]">>},{<<"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');
});
}
}