Skip to content

Instantly share code, notes, and snippets.

View cuonggt's full-sized avatar

Cuong Giang cuonggt

View GitHub Profile
@cuonggt
cuonggt / .php-cs-fixer.dist.php
Last active July 14, 2022 03:24
PHP CS Fixer Laravel preset
<?php
use PhpCsFixer\Config;
use PhpCsFixer\Finder;
$rules = [
'array_indentation' => true,
'array_syntax' => ['syntax' => 'short'],
'binary_operator_spaces' => [
'default' => 'single_space',
@cuonggt
cuonggt / .dockerignore
Created June 29, 2020 08:27 — forked from yizeng/.dockerignore
An example .dockerignore file for Rails
.git
.gitignore
# Created by https://www.gitignore.io/api/git,ruby,rails,jetbrains+all
# Edit at https://www.gitignore.io/?templates=git,ruby,rails,jetbrains+all
### Git ###
# Created by git for backups. To disable backups in Git:
# $ git config --global mergetool.keepBackup false
*.orig
@cuonggt
cuonggt / App.js
Last active September 13, 2018 08:33
Demo paginator
import React, { Component } from 'react';
import Paginator from './Paginator';
class App extends Component {
state = {
currentPage: 1,
total: 686,
perPage: 10,
};
stages:
- build
- test
# Variables
variables:
MYSQL_ROOT_PASSWORD: root
MYSQL_USER: homestead
MYSQL_PASSWORD: secret
MYSQL_DATABASE: homestead
@cuonggt
cuonggt / abDatepicker.directive.js
Created October 25, 2017 12:32
AngularJS directive for Bootstrap datepicker
angular
.module('directives.abDatepicker', [])
.directive('abDatepicker', abDatepicker);
abDatepicker.$inject = [];
/* @ngInject */
function abDatepicker() {
return {
require: 'ngModel',
# stop script on error signal
set -e
# remove old deployment folders
if [ -d "/home/forge/weather-deploy" ]; then
rm -R /home/forge/weather-deploy
fi
if [ -d "/home/forge/weather-backup" ]; then
rm -R /home/forge/weather-backup
fi
@cuonggt
cuonggt / fbComments.directive.js
Created October 15, 2017 17:31
Facbook comments directive for AngularJS
angular.module('directives.fbComments', [])
.directive('fbComments', fbComments);
fbComments.$injects = ['$timeout'];
function fbComments($timeout) {
function createHTML(href, numposts) {
return '<div class="fb-comments" ' +
'data-href="' + href + '" ' +
'data-numposts="' + numposts + '">' +
@cuonggt
cuonggt / angularjs-routes.js
Created October 11, 2017 02:38
AngularJS: Adding One Resolve to All Routes
angular
.module('app')
.config(config);
function config($routeProvider, $locationProvider) {
var universalResolves = {
catalogIds: function ($http, $rootScope, $localStorage, $q) {
if ($localStorage.catalogIds) {
return $q.when($localStorage.catalogIds);
}
import React, { Component } from 'react';
import axios from 'axios';
import FormErrors from './FormErrors';
export default class LoginForm extends Component {
constructor(props) {
super(props);
this.state = {
email: '',
@cuonggt
cuonggt / .gvimrc
Created May 22, 2017 11:10
Vim dot files
"Disable the print key for Macvim.
if has("gui_macvim")
macmenu &File.Print key=<nop>
set macligatures "We want pretty symbols, when available.
endif