Skip to content

Instantly share code, notes, and snippets.

View trungx's full-sized avatar
🚩
Go to 2022

trungx

🚩
Go to 2022
View GitHub Profile
@trungx
trungx / send_json_post_auth_with_guzzle.php
Created March 2, 2019 11:40 — forked from roberto-butti/send_json_post_auth_with_guzzle.php
Send a JSON in a POST, with HTTP Basic Auth (Guzzle Version)
<?php
$endpoint_url="your_url_here";
$string_json = "your_json_string";
$username="username";
$password ="password";
$client = new Client();
$options= array(
'auth' => [
$username,
@trungx
trungx / meta-programming.php
Created February 15, 2019 04:38 — forked from ziadoz/meta-programming.php
Basic Meta Programming with PHP 5.4
<?php
trait MetaClass
{
protected $__classMethods = array();
static protected $__staticMethods = array();
public function __call($name, $args)
{
@trungx
trungx / project-create.sh
Created December 21, 2018 10:55 — forked from francoisromain/project-create.sh
A bash script to create a Git post-receive hook to deploy after a Git push
#!/bin/bash
# Call this file with `bash ./project-create.sh project-name [service-name]`
# - project-name is mandatory
# - service-name is optional
# This will creates 4 directories and a git `post-receive` hook.
# The 4 directories are:
# - $GIT: a git repo
# - $TMP: a temporary directory for deployment
@trungx
trungx / README.md
Created December 17, 2018 08:23 — forked from ericclemmons/README.md
Hot take on Zach Silveira's Gutenblock Demo!
@trungx
trungx / vietnam_map.js
Created November 7, 2018 06:51 — forked from tungisme/vietnam_map.js
Vietnam jVectorMap
jQuery.fn.vectorMap('addMap', 'vietnam', {"width":"210","height":"297","paths":{"1":{"name":"An Giang","path":"m70.81 255.70l0.57 -0.74c0.38 0.04 0.38 0.07 0.64 -0.26c0.25 -0.31 0.38 -0.03 0.51 0.01c-0.30 0.59 1.56 0.12 1.80 0.00c0.17 -0.08 -0.02 -0.34 0.04 -0.48c0.09 -0.24 0.38 -0.07 0.58 -0.14c0.12 -0.04 0.44 -0.34 0.57 -0.48l0.15 -0.14l0.00 0.00c0.00 -0.21 -0.06 -0.37 0.14 -0.51c0.20 -0.13 0.34 -0.08 0.30 -0.39c-0.02 -0.20 0.02 -0.24 0.19 -0.35c0.19 -0.11 0.17 -0.32 0.25 -0.50c0.12 -0.25 0.55 0.08 0.55 -0.43c0.05 -0.43 -0.25 -0.97 -0.58 -1.23c-0.57 -0.44 -0.78 -0.39 -1.50 -0.42c-0.60 -0.02 -0.71 -0.33 -1.19 -0.48c-0.72 -0.23 -0.60 -1.21 -0.85 -1.74c0.02 -0.19 0.33 -0.86 0.02 -0.95c-0.22 -0.06 -1.30 0.27 -0.82 -0.38c0.23 -0.31 0.30 -0.39 -0.18 -0.47c-0.50 -0.07 -0.10 -0.44 -0.48 -0.61c-0.18 -0.08 -0.35 0.02 -0.38 -0.23c-0.03 -0.27 -0.32 -0.25 -0.42 -0.48l-0.22 -0.71l0.00 0.00c-0.85 -0.11 -1.66 -0.20 -1.80 -0.43c-0.19 -0.31 0.28 -0.57 -0.32 -0.57l-0.47 0.35c0.08 0.23 0.00 0.48 -0.12 0.76c-0.24 0.55 0.24 1.62
@trungx
trungx / .htaccess
Created November 2, 2018 04:11 — forked from theperrygroup/.htaccess
Redirect subdomain to subfolder
RewriteEngine on
RewriteCond %{HTTP_HOST} ^subdomain\.example\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.subdomain\.example\.com$
RewriteRule ^/?$ "http\:\/\/www\.example\.com\/subdomain\/" [R=301,L]
@trungx
trungx / counter_reactjs.html
Created October 2, 2018 08:02 — forked from nastanford/counter_reactjs.html
Simple Example React Code used on jsComplete.com
class Button extends React.Component {
handleClick = () => {
this.props.onClickFunction(this.props.incrementValue);
};
render() {
return (
<button onClick={this.handleClick}>
+{this.props.incrementValue}
</button>
@trungx
trungx / Enhance.js
Created September 28, 2018 04:05 — forked from sebmarkbage/Enhance.js
Higher-order Components
import { Component } from "React";
export var Enhance = ComposedComponent => class extends Component {
constructor() {
this.state = { data: null };
}
componentDidMount() {
this.setState({ data: 'Hello' });
}
render() {
@trungx
trungx / MYSQL_CHEATSHET_README.md
Last active May 3, 2019 03:31 — forked from hofmannsven/README.md
My simply MySQL Command Line Cheatsheet