This file contains hidden or 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
# rename file's name: | |
for f in *.eco;do base=${f/.eco/};mv $f $base;done | |
# Pretty mongodb output: | |
db.collection.find().pretty() | |
# Pretty mongodb output by default: | |
DBQuery.prototype._prettyShell = true | |
to $HOME/.mongorc.js |
This file contains hidden or 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
// 1.Take me nearly 1.5 hours to figure it out | |
function buildTotalPrice(ths, arrs) { | |
var _arrs = [] | |
var l = ths.length - 1 | |
for (var i = 0; i < l; i++) { | |
var _arr = 0 | |
for (var n = 0, m = arrs.lenth; n < m; n++) { |
This file contains hidden or 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
1. Session err for req.logIn | |
a. Make sure you pass user to logIn: | |
req.logIn(user, function(err) { | |
if (err) return next(err) | |
mail.sendActiveMail(user.email, user.token, user.username) | |
return res.json({ | |
success: 1 | |
}) | |
}) |
This file contains hidden or 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
# Sometimes, you just have to shutdown and reboot your linode. Then all the services running on your linode should be booted again: | |
1. Shundown/reboot linode | |
2. Stop the httpd service by default: service httpd stop | |
3. Repair your mongodb for some reasons: | |
a. Find out and kill all the process: | |
ps -ef | grep mongo* | |
ps -ef | grep mongod | |
kill -9 pid | |
#If it doesn't work, then you can pkill -9 mongod once for all. |
This file contains hidden or 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
KISSY.use("dom, node, event, ajax, promise", function(S, DOM, Node, Event, IO, Promise) { | |
function setGamesNumber(deferred) { | |
var dataFetch = new IO({ | |
dataType: 'jsonp', | |
url: 'http://display.taobao.com/common/addSignIn.htm?app=duli&sequency=1&signType=1', | |
jsonp: 'callback', | |
jsonpCallback: "handleResponse" | |
}) |
This file contains hidden or 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
// drop indexes | |
db.accounts.dropIndex( { "tax-id": 1 } ) | |
db.collection.dropIndexes() |
This file contains hidden or 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
(function(angular) { | |
angular.module('analytics', ['ng']).service('analytics', [ | |
'$rootScope', '$window', '$location', function($rootScope, $window, $location) { | |
var track = function() { | |
$window._gaq.push(['_trackPageview', $location.path()]); | |
}; | |
$rootScope.$on('$viewContentLoaded', track); | |
} | |
]); |
This file contains hidden or 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
// 判断各种浏览器,找到正确的方法 | |
function launchFullscreen(element) { | |
if(element.requestFullscreen) { | |
element.requestFullscreen(); | |
} else if(element.mozRequestFullScreen) { | |
element.mozRequestFullScreen(); | |
} else if(element.webkitRequestFullscreen) { | |
element.webkitRequestFullscreen(); | |
} else if(element.msRequestFullscreen) { | |
element.msRequestFullscreen(); |
This file contains hidden or 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
String.prototype.format = function() { | |
var formatted = this; | |
var arg = arguments[0]; | |
var regexp = null; | |
var key = null; | |
if(arg === Object(arg) && arg instanceof Array !== true) { | |
for(key in arg) { | |
if(arg.hasOwnProperty(key)) { | |
regexp = new RegExp('\\{{' + key + '\\}}', 'gi'); | |
formatted = formatted.replace(regexp, arg[key]); |
This file contains hidden or 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://devstreaming.apple.com/videos/wwdc/2014/403xxksrj0qs8c0/403/403_hd_intermediate_swift.mov?dl=1 | |
http://devstreaming.apple.com/videos/wwdc/2014/403xxksrj0qs8c0/403/403_sd_intermediate_swift.mov?dl=1 | |
http://devstreaming.apple.com/videos/wwdc/2014/403xxksrj0qs8c0/403/403_intermediate_swift.pdf?dl=1 | |
http://devstreaming.apple.com/videos/wwdc/2014/419xxli6f60a6bs/419/419_hd_advanced_graphics_and_animation_performance.mov?dl=1 | |
http://devstreaming.apple.com/videos/wwdc/2014/419xxli6f60a6bs/419/419_sd_advanced_graphics_and_animation_performance.mov?dl=1 | |
http://devstreaming.apple.com/videos/wwdc/2014/419xxli6f60a6bs/419/419_advanced_graphics_and_animation_performance.pdf?dl=1 | |
http://devstreaming.apple.com/videos/wwdc/2014/101xx36lr6smzjo/101/101_hd.mov?dl=1 | |
http://devstreaming.apple.com/videos/wwdc/2014/101xx36lr6smzjo/101/101_sd.mov?dl=1 | |
http://devstreaming.apple.com/videos/wwdc/2014/236xxwk3fv82sx2/236/236_hd_building_interruptible_and_responsive_interactions.mov?dl=1 | |
http://devstreaming.apple.com/videos/wwdc/2 |