Skip to content

Instantly share code, notes, and snippets.

View decodedmrq's full-sized avatar
🏠
Working from home

Quyen Nguyen decodedmrq

🏠
Working from home
View GitHub Profile
@decodedmrq
decodedmrq / three.doc.js
Created January 16, 2022 17:10 — forked from kopiro/three.doc.js
ThreeJS DeviceOrientationControls
/**
* @author richt / http://richt.me
* @author WestLangley / http://github.com/WestLangley
*
* W3C Device Orientation control (http://w3c.github.io/deviceorientation/spec-source-orientation.html)
*/
THREE.DeviceOrientationControls = function( object ) {
var scope = this;
"encodingJob": {
"M": {
"Role": {
"S": "arn:aws:iam::test:role/vod-test-MediaConvertRole-5I6IRWVD5W20"
},
"UserMetadata": {
"M": {
"workflow": {
"S": "vod-test"
},
@decodedmrq
decodedmrq / laravel-quickstart-project-docker.md
Created August 10, 2021 17:04 — forked from wataridori/laravel-quickstart-project-docker.md
Running Laravel Quick Start Project easily using Docker
  • Install Docker
    • Docker for Ubuntu: https://docs.docker.com/engine/installation/linux/ubuntulinux/
      sudo apt-get update && apt-get install -y apt-transport-https ca-certificates
      sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
      
      // Open the /etc/apt/sources.list.d/docker.list and add the following line then save it
      // Ubuntu 14.04
      deb https://apt.dockerproject.org/repo ubuntu-trusty main
      

// Ubuntu 16.04

@decodedmrq
decodedmrq / RegisterRequest.php
Created August 10, 2021 17:01 — forked from tuanpht/RegisterRequest.php
Laravel Form Request Testing
<?php
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rules\Unique;
class RegisterRequest extends FormRequest
{
const NAME_MAX_LENGTH = 255;
const EMAIL_MAX_LENGTH = 255;
const PASSWORD_MIN_LENGTH = 8;
@decodedmrq
decodedmrq / xmlrpc.php
Created July 7, 2021 18:19 — forked from hofmeister/xmlrpc.php
PHP simple XML-RPC Client
<?php
/**
* @author Henrik Hofmeister
* @license MIT
* @version 1.0
*
* XmlRPC using SimpleXML and CURL
*
* Usage:
*
@decodedmrq
decodedmrq / curl.md
Created July 6, 2021 17:27 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@decodedmrq
decodedmrq / Git-Pre-commit-setup.md
Created June 30, 2021 17:26 — forked from sdavara/Git-Pre-commit-setup.md
Git-pre-commit-hooks for PHP/Laravel Project

Pre Commit Setup

Setup pre-commit hook in php projects for lint, code standard, test cases etc.

Prerequisites

  • php >= 5.6
  • composer
  • git

Installation

@decodedmrq
decodedmrq / gist:3080091ea2b714e88e80c1343338f725
Created June 28, 2021 03:06
Get all Css Rules apply element (include media queries)
// polyfill window.getMatchedCSSRules() in FireFox 6+
if (typeof window.getMatchedCSSRules !== 'function') {
var ELEMENT_RE = /[\w-]+/g,
ID_RE = /#[\w-]+/g,
CLASS_RE = /\.[\w-]+/g,
ATTR_RE = /\[[^\]]+\]/g,
// :not() pseudo-class does not add to specificity, but its content does as if it was outside it
PSEUDO_CLASSES_RE = /\:(?!not)[\w-]+(\(.*\))?/g,
PSEUDO_ELEMENTS_RE = /\:\:?(after|before|first-letter|first-line|selection)/g;
// convert an array-like object to array
@decodedmrq
decodedmrq / dantri.com.js
Created June 14, 2021 16:05 — forked from anhdiepmmk/dantri.com.js
Sử dụng puppeteer, cheerio của js để crawler trang web có ajax
const puppeteer = require('puppeteer');
const cheerio = require('cheerio');
(async () => {
const browser = await puppeteer.launch({headless: false, devtools: true})
const page = await browser.newPage()
await page.goto('https://dantri.com.vn/')
//https://github.com/cheeriojs/cheerio
let content = await page.content();
@decodedmrq
decodedmrq / gist:7a18702f50ae255c59cb21b3cfee5a4f
Created May 10, 2021 04:06
Change password in mysql with plugin
*auth_socket* If you install 5.7 and don’t provide a password to the root user, it will use the auth_socket plugin. That plugin doesn’t care and doesn’t need a password. It just checks if the user is connecting using a UNIX socket and then compares the username.
*mysql_native_password*
If we want to configure a password, we need to change the plugin and set the password at the same time, in the same command. First changing the plugin and then setting the password won’t work, and it will fall back to auth_socket again
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'test';
Normal change password for root mysql.user: ALTER USER 'root'@'localhost' IDENTIFIED BY '2DEyjZKiN6';