Skip to content

Instantly share code, notes, and snippets.

@maxlibin
maxlibin / A-Pen-by-max.markdown
Created November 19, 2013 08:22
A Pen by max.
@maxlibin
maxlibin / Snow.markdown
Created November 18, 2013 10:36
A Pen by max.
@maxlibin
maxlibin / nodequery.js
Last active December 24, 2015 21:19
Node.js mongoose query if item exist in array,and insert and update if does not...
exports.user_post_emails = function(req, res){
var emails = [];
Mongoose_Collection.findOne({userId: req.user._id}, function(err, user){
if(!user){
emails[0] = req.body.emails;
new Mongoose_Collection({
emails: emails,
userId:req.user._id
@maxlibin
maxlibin / gist:5771629
Last active December 18, 2015 10:49
Asia country list in select field
<select name="countries">
<option selected="selected" disabled="disalbed">Select Your Country</option>
<option value="china">China</option>
<option value="India">India</option>
<option value="Indonesia">Indonesia</option>
<option value="Pakistan">Pakistan</option>
<option value="Bangladesh">Bangladesh</option>
<option value="Japan">Japan</option>
<option value="Philippines">Philippines</option>
@maxlibin
maxlibin / new_gist_file
Created April 23, 2013 04:29
if you installed MAMP and mysql command line returns error
/Applications/MAMP/Library/bin/mysql -u root -p
@maxlibin
maxlibin / new_gist_file
Created March 26, 2013 10:19
Magento Show review form on catalog page
//the form code lives in app/design/frontend/yourtemplate/default/template/review/form.phtml
//in catalog.xml enable it with:
<block type="review/form" name="product.info.review_form" as="review_form" template="review/form.phtml"/>
<?php echo $this->getChildHtml('review_form'); ?>