Skip to content

Instantly share code, notes, and snippets.

View nguyenbathanh's full-sized avatar

Thanh Nguyen nguyenbathanh

View GitHub Profile
@nguyenbathanh
nguyenbathanh / update-to-php5.6-on-ubuntu-14.04.sh
Created August 10, 2017 14:01 — forked from eyecatchup/update-to-php5.6-on-ubuntu-14.04.sh
Update PHP 5.x to PHP 5.6 on Ubuntu 14.04
#!/bin/sh
# In case df shows >90% for /boot run:
#sudo apt-get autoremove
# Add repository
sudo add-apt-repository ppa:ondrej/php
# Install required packages
sudo apt-get update
// Place your settings in this file to overwrite the default settings
{
"editor.fontFamily": "DejaVu Sans Mono",
// "files.trimTrailingWhitespace": true,
"editor.fontSize": 14,
"editor.tabSize": 2,
"files.eol": "\n",
"editor.cursorBlinking": "smooth",
"search.exclude": {
"**/.git": true,
@nguyenbathanh
nguyenbathanh / config
Last active January 3, 2018 14:51
My sublime settings
{
// "auto_complete_cycle": true,
"caret_extra_bottom": 1,
"caret_extra_top": 2,
"caret_extra_width": 1,
"caret_style": "blink",
"drag_text": false,
"draw_white_space": "none",
// "ensure_newline_at_eof_on_save": true,
"folder_exclude_patterns":
$spinner-color: #69717d !default
$spinner-size: 48px !default
.overlay
background: rgba(black,.8)
height: 100vh
.spinner
font-size: $spinner-size
position: relative
@nguyenbathanh
nguyenbathanh / foo.log
Created May 15, 2017 09:12 — forked from ibeex/foo.log
Flask logging example
A warning occurred (42 apples)
An error occurred
@nguyenbathanh
nguyenbathanh / gist:3f78dad52471a43691c7bc58978689e8
Created May 1, 2017 08:53
Set custom user agent of Chrome on start
--disable-directwrite-for-ui --user-agent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.81 Safari/537.36"
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ru" lang="ru">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />
<title>���������</title>
<meta name="description" content="��������� - ������ ���������� ���� �������� ��������� ���������� � ������� ���" />
<meta name="keywords" content="�����, ���������, �������, ������, ������������, �������" />
<meta name="generator" content="DataLife Engine (http://dle-news.ru)" />
<link rel="search" type="application/opensearchdescription+xml" href="http://www.klassprof.org/engine/opensearch.php" title="���������" />
<link rel="alternate" type="application/rss+xml" title="���������" href="http://www.klassprof.org/rss.xml" />
@nguyenbathanh
nguyenbathanh / isint.js
Last active February 23, 2017 10:45
Javascript check input is integer or not.
function isInt(value) {
return !isNaN(value) && (function(x) { return (x | 0) === x; })(parseFloat(value))
}
@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.