Skip to content

Instantly share code, notes, and snippets.

View flashvnn's full-sized avatar

Huynh Khac Thao flashvnn

View GitHub Profile
@flashvnn
flashvnn / term.php
Created October 13, 2014 13:43
Get term child by tid
<?php
/**
* Return all term child tids.
*/
function helper_get_all_term_child_tids($tid) {
$query = db_select('taxonomy_term_data', 'd');
$query->fields('d', array('tid'));
$query->innerJoin('taxonomy_term_hierarchy', 'h', 'd.tid = h.tid');
$query->condition('h.parent', $tid);
@flashvnn
flashvnn / bushwacker_extras.module
Created October 22, 2014 07:00
Override expose form.
/**
* Implements hook_form_alter().
*/
function bushwacker_extras_form_alter(&$form, &$form_state, $form_id) {
if ($form_id == "views_exposed_form" && $form['#id'] == 'views-exposed-form-search-api-results-solr-page') {
$options = bushwacker_extras_build_vehicel_otions();
$form['field_make'] = array(
@flashvnn
flashvnn / DrupalOAuthClient.inc
Created October 31, 2014 04:25
disable curl ssl verify
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
@flashvnn
flashvnn / bitbucket.php
Created January 20, 2015 10:06
Bitbucket Autodeploy
<?php
// Make sure we have a payload, stop if we do not.
if( ! isset( $_POST['payload'] ) )
die( '<h1>No payload present</h1><p>A BitBucket POST payload is required to deploy from this script.</p>' );
/**
* Tell the script this is an active end point.
*/
define( 'ACTIVE_DEPLOY_ENDPOINT', true );
@flashvnn
flashvnn / jquery.ui.css
Created January 22, 2015 14:01
Fix jquery ui dialog with bootstrap
.ui-dialog .ui-dialog-content{
width: auto !important;
-webkit-box-sizing: initial; -moz-box-sizing:initial; box-sizing: initial;
}
@flashvnn
flashvnn / advanced-ajax.js
Created February 13, 2015 17:25
Drupal advanced-ajax
(function ($) {
Drupal.behaviors.AdvancedAJAXExamples = {
attach: function (context, settings) {
/**
* Use a class to bind custom behavior to a link. As it happens, the behavior
* if this link is nearly exactly the same as with "use-ajax". But instead
* we are ensuring that the throbber is active.
@flashvnn
flashvnn / thuoc_tri_phu_thung
Created February 23, 2015 14:10
Bai thuoc tri phu thung
Cay Chan Chim
Ha Thu O
Dua gai
Cu Rang Bay
Dau Tam an
3 chen con 8 phan
2 lan/thang/ngay
@flashvnn
flashvnn / views-custom-title.php
Last active August 29, 2015 14:16
Views Custom Title
$view = new view();
$view->name = 'demo';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'node';
$view->human_name = 'Demo';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
@flashvnn
flashvnn / install-php5.5.php
Created February 28, 2015 15:38
Install PHP 5.5 on CentOS
https://der-linux-admin.de/2014/12/centos-zusaetzliche-php-versionen-php-5-5-php-5-4-fuer-plesk-bereitstellen/
PHP-Versionen (PHP 5.4 / PHP 5.5) unter für CentOS 6
Installation des Software Collections Repository für PHP 5.5:
yum install https://www.softwarecollections.org/en/scls/rhscl/php55/epel-6-x86_64/download/rhscl-php55-epel-6-x86_64.noarch.rpm yum install https://www.softwarecollections.org/en/scls/remi/php55more/epel-6-x86_64/download/remi-php55more-epel-6-x86_64.noarch.rpm
1
2
yum install https://www.softwarecollections.org/en/scls/rhscl/php55/epel-6-x86_64/download/rhscl-php55-epel-6-x86_64.noarch.rpm
@flashvnn
flashvnn / wp-post-json.php
Created March 11, 2015 02:52
Wordpress Post to JSON
<?php
// include our wordpress functions
// change relative path to find your WP dir
define('WP_USE_THEMES', false);
require('./blog/wp-blog-header.php');
// set header for json mime type
header('Content-type: application/json;');
// get latest single post