When visit Virtual Box site, the client ip is gateway of virtual machine, not your dev machine ip.
- Add
import pdb;pdb.set_trace()
to any Django view, and open the view in chrome - Switch to termianl,
request.META.get('REMOTE_ADDR', None)
at the break point - The result is the true client ip address
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Using AMD/RequireJS | |
* | |
* The `auth` module handles OAuth and stores the | |
* access token that needs to be sent in a header | |
*/ | |
define(['api/auth'], function (auth) { | |
'use strict'; | |
/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name socialbase content list replace url | |
// @namespace http://use.i.E.your.homepage/ | |
// @version 0.1.1 | |
// @description enter something useful | |
// @match http://socialbase.hk/socialbase/content/* | |
// @copyright 2014+, bammoo | |
// ==/UserScript== | |
require(['jquery'], function($) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// when model.attributes is different from the params to save | |
// e.g. when save to restful api, one attr should be `resource_uri` | |
// formated as string type, but the returned attr value in json is object formated | |
var model = new Backbone.Model(); | |
model.save(null, { | |
wait: true, | |
success: function() { | |
}, | |
attrs: _.omit(model.attributes, 'selected') | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var require = { | |
paths: { | |
'jquery': '../../bower_components/zepto/zepto.min' | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* extend/zepto.js | |
*/ | |
define([ | |
'zepto' | |
], function() { | |
"use strict"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://guides.rubygems.org/command-reference/#gem-environment | |
--- | |
:backtrace: true | |
:bulk_threshold: 1000 | |
:benchmark: false | |
:sources: | |
- http://ruby.taobao.org/ | |
:update_sources: true | |
:verbose: true | |
gem: --no-document |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$form.validate({ | |
ignore: '.ignore', | |
rules: rules, | |
messages: messages, | |
invalidHandler: function(event, validator) { | |
// console.log(event, validator); | |
var errorEl = validator.findLastActive() || validator.errorList.length && validator.errorList[0].element; | |
if(errorEl) | |
$(errorEl).closest('.accordion-body').collapse('show'); | |
}, |
OlderNewer