Skip to content

Instantly share code, notes, and snippets.

View huanglong-zz's full-sized avatar
🎯
Focusing

Scott Dong huanglong-zz

🎯
Focusing
View GitHub Profile
# 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
// 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++) {
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
})
})
# 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.
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"
})
// drop indexes
db.accounts.dropIndex( { "tax-id": 1 } )
db.collection.dropIndexes()
(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);
}
]);
// 判断各种浏览器,找到正确的方法
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();
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]);
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