Skip to content

Instantly share code, notes, and snippets.

@dungtd91
dungtd91 / gist:84d2790b487844b44de3
Created November 20, 2015 12:08 — forked from thachpham92/gist:d57b18cf02e3550acdb5
Tất cả các tham số trong WP_Query
// Source: https://gist.github.com/luetkemj/2023628
<?php
$args = array(
//////Author Parameters - Tham số lấy bài viết theo tác giả
//http://codex.wordpress.org/Class_Reference/WP_Query#Author_Parameters
'author' => '1,2,3,', //(int) - Các ID tác giả cần lấy bài viết (thêm dấu - vào để loại trừ tác giả, ví dụ: -14, -20)
'author_name' => 'luetkemj', //(string) - Lấy bài viết dựa theo tên nick name của tác giả
'author__in' => array( 2, 6 ), //(array) - Lấy bài dựa theo ID của tác giả
'author__not_in' => array( 2, 6 ), //(array)' - Các ID của tác giả không muốn lấy bài
@dungtd91
dungtd91 / wordpress-base-custom-data.php
Created December 3, 2015 09:40 — forked from paulund/wordpress-base-custom-data.php
A PHP class to handle CRUD functionality in WordPress default tables.
<?php
/**
* Abstract class which has helper functions to get data from the database
*/
abstract class Base_Custom_Data
{
/**
* The current table name
*
* @var boolean
@dungtd91
dungtd91 / flexslider.htm
Created June 12, 2016 07:16 — forked from AllThingsSmitty/flexslider.htm
Lazy loading images for FlexSlider
<section class="slider">
<div class="flexslider">
<ul class="slides">
<li><img src="http://imgur.com/..." alt=""></li>
<li><img class="lazy" data-src="http://imgur.com/..." alt=""></li>
<li><img class="lazy" data-src="http://imgur.com/..." alt=""></li>
<li><img class="lazy" data-src="http://imgur.com/..." alt=""></li>
<li><img class="lazy" data-src="http://imgur.com/..." alt=""></li>
</ul>
</div>
@dungtd91
dungtd91 / jquery.class.js
Created June 19, 2016 12:58 — forked from jonathonbyrdziak/jquery.class.js
jQuery OOP Class: This allows you to easily create a class in Jquery.
/*!
* Simple JavaScript Inheritance
* By John Resig http://ejohn.org/
* MIT Licensed.
*
* Extended by Jonathon Byrd to include function hooks
* https://gist.github.com/Jonathonbyrd/724083
*
* Don't forget your Shims!
* https://github.com/kriskowal/es5-shim/blob/master
@dungtd91
dungtd91 / pasz.js
Created July 12, 2016 16:22 — forked from wilvandertuin/pasz.js
Bare jQuery plugin using revealing module pattern
/**
* Minimum set up for a revealing module pattern jQuery plugin
*
* This is a bare plugin that uses the revealing module pattern to attach
* public and private vars and methods to a jQuery selector.
*
* Example:
*
* $('#menu').collapsible().init();
* $('#menu').collapsible().open();
var app = (function(w, d){
var myPrivateVariable = "My private content";
var __private = {
cache : function(){
this.link = d.querySelector('.link-item');
}
bind : function(){
this.link.addEventListener('click', this.handleClick, false);
},

Design Pattern

  • name
  • intent
  • problem/motivation
  • solution
  • structure
  • code
  • consequences & trade-offs

Creational

@dungtd91
dungtd91 / gist:b8f92486747faca04c72f400939ebfe9
Created August 24, 2016 13:29 — forked from Neolot/gist:7189739
WORDPRESS Ajax contact-form
<!-- contactform.php -->
<div class="cf" id="cf">
<form action="javascript:void(0);">
<div><input type="text" name="name" placeholder="Name"/><span class="error"></span></div>
<div><input type="text" name="email" placeholder="Email"/><span class="error"></span></div>
<div><textarea name="message" placeholder="Message"></textarea><span class="error"></span></div>
<div><button type="submit">Submit</button> <span class="loader"></span></div>
</form>
</div>
@dungtd91
dungtd91 / CAPTCHA.js
Created October 2, 2016 14:48 — forked from SneakyBrian/CAPTCHA.js
Implementing CAPTCHA client-side using HTML5 canvas
(function (window, document, $, undefined) {
var possibleCharacters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
var defaults = {
selector: "#captcha",
text: null,
randomText: true,
randomColours: true,
@dungtd91
dungtd91 / 01_Laravel 5 Simple ACL manager_Readme.md
Created January 17, 2017 04:51 — forked from amochohan/01_Laravel 5 Simple ACL manager_Readme.md
Laravel 5 Simple ACL - Protect routes by an account / role type

#Laravel 5 Simple ACL manager

Protect your routes with user roles. Simply add a 'role_id' to the User model, install the roles table and seed if you need some example roles to get going.

If the user has a 'Root' role, then they can perform any actions.

Installation

Simply copy the files across into the appropriate directories, and register the middleware in App\Http\Kernel.php