Skip to content

Instantly share code, notes, and snippets.

View nguyenbathanh's full-sized avatar

Thanh Nguyen nguyenbathanh

View GitHub Profile
@nguyenbathanh
nguyenbathanh / run.js
Created February 10, 2017 04:01
Mongodb how to remove duplicate entries in arrays
// http://codingtricks.fidibuy.com/participant/join/5474b4eab7606ef9d71c045a/MongoDb:-how-to-remove-duplicate-entries-in-arrays
// with modification
// MongoDB GUI Tools: https://studio3t.com/download
var fixFieldName = "primary_images";
var collectionName = "my_collection";
db[collectionName].find({
"_id": ObjectId("5762a2d397694a5295176697")
@nguyenbathanh
nguyenbathanh / MultiPartFromStrings.php
Created January 24, 2017 04:23 — forked from iansltx/MultiPartFromStrings.php
Multipart file uploads in PHP from strings
<?php
/**
* PHP's curl extension won't let you pass in strings as multipart file upload bodies; you
* have to direct it at an existing file (either with deprecated @ syntax or the CURLFile
* type). You can use php://temp to get around this for one file, but if you want to upload
* multiple files then you've got a bit more work.
*
* This function manually constructs the multipart request body from strings and injects it
* into the supplied curl handle, with no need to touch the file system.
@nguyenbathanh
nguyenbathanh / install.sh
Last active January 10, 2017 08:58
Install Nodejs, LAMP, Composer
#!/bin/sh
# update
sudo apt-get update
# curl
sudo apt-get install -y curl
# openssh
sudo apt-get install -y openssh-server
@nguyenbathanh
nguyenbathanh / config.json
Last active November 25, 2016 10:49
esformatter-jsx best configuration
{
"jsx": {
"attrsOnSameLineAsTag": false,
"maxAttrsOnTag": 1,
"firstAttributeOnSameLine": false,
"alignWithFirstAttribute": true
},
"indent": {
"value": " ",
"ArrayExpression": 1,
var Col = require('react-bootstrap/lib/Col')
var PageHeader = require('react-bootstrap/lib/PageHeader')
var React = require('react')
var Row = require('react-bootstrap/lib/Row')
var {connect} = require('react-redux')
var {reduxForm} = require('redux-form')
var DateInput = require('./DateInput')
var FormField = require('./FormField')
var LoadingButton = require('./LoadingButton')
server {
listen 80;
server_name react.dev;
root /app/react-demo;
location / {
include /etc/nginx/mime.types;
try_files $uri $uri/ /index.html;
}
}
{
"response_code": 200,
"message": null,
"data": {
"flag": true
}
}
{
"response_code": 200,
"message": null,
"data": {
"pendingEvaluations": [
"Cooor_97"
]
}
}
<ul class="nav nav-tabs left-bar" style="border-bottom:1px solid #ccc !important;background-color:#fff;">
<div class="col-xs-6"><li class="active"><a href="#1" data-toggle="tab" style=""><span class="number">0</span>jjjjjjjjjjjjjjjjjjjjjjjjjjjj</a></li></div>
<div class="col-xs-6"><li><a href="#2" data-toggle="tab" style="text-align: center;"><span class="number">0</span><br>Unassigned</a></li></div>
<div class="col-xs-6"><li><a href="#3" data-toggle="tab" style="text-align:center;"><span class="number">0</span><br>Completed</a></li></div>
</ul>