Skip to content

Instantly share code, notes, and snippets.

View geraldvillorente's full-sized avatar

Stoick The Vast geraldvillorente

  • Philippines
View GitHub Profile
@geraldvillorente
geraldvillorente / gist:8673463
Created January 28, 2014 18:37
# Create Drupal coding standard symlink inside PHP Codesniffer
link "/vagrant/bin/coder_module/coder_sniffer/Drupal" do
to "/usr/share/php/PHP/CodeSniffer/Standards/Drupal"
link_type :symbolic
action :create
end
@geraldvillorente
geraldvillorente / angular_refresh.admin.inc
Last active August 29, 2015 14:06
Add more field using #ajax framework in Drupal 7
<?php
/**
* @file
* Angular View admin file.
*/
function angular_refresh_endpoints($form, &$form_state, $no_js_use = FALSE) {
$form['#attached']['css'] = array(
drupal_get_path('module', 'angular_refresh') . '/angular_refresh.css',
);
@geraldvillorente
geraldvillorente / ubuntu-vagrant-drupal
Created November 27, 2014 00:12
Setting up a Drupal Environment in Ubuntu Vagrant
Do these steps inside your Vagrant machine.
1. Web Server
sudo apt-get install apache2
2. PHP5
sudo apt-get install php5 libapache2-mod-php5
3. MySQL
sudo apt-get install mysql-server mysql-client
@geraldvillorente
geraldvillorente / vagrant-virtualbox-failed
Created December 1, 2014 22:43
VirtualBox is complaining that the kernel module is not loaded
drupal drupalvdd: vagrant up
The provider 'virtualbox' that was requested to back the machine
'default' is reporting that it isn't usable on this system. The
reason is shown below:
VirtualBox is complaining that the kernel module is not loaded. Please
run `VBoxManage --version` or open the VirtualBox GUI to see the error
message which should contain instructions on how to fix this error.
Solution:
@geraldvillorente
geraldvillorente / gist:2dd435f6cd7ac98da7eb
Created December 17, 2014 01:05
Getting the latest watchdog entry from watchdog table using watch command
watch -n 1 "mysql -u <user> -e 'SELECT message, referer, FROM_UNIXTIME('timestamp') FROM watchdog ORDER BY 'timestamp' DESC LIMIT 0,1' <database_name>"
@geraldvillorente
geraldvillorente / rsynctify
Last active October 30, 2020 16:09
A simple script of using rsync and inotify to manage two separate repositories.
#!/usr/bin/env bash
#
# @file
# A one directional auto-sync triggered by inotify.
# The inotify-utils must be installed in the system
# before using this script.
#
# @source
# $SOURCE - A git repository.
#
@geraldvillorente
geraldvillorente / icon.txt
Last active August 17, 2017 11:40
Creating custom plugin for Ckeditor.
// Location: ckeditor_plugins/qna/icons
This is where you put the plugin icon.
@geraldvillorente
geraldvillorente / gist:48bbdfa630bb8a358612
Created February 3, 2015 13:14
Convert REQUEST_TIME into human-readable format
$machine_format = 1422969167;
echo date('l, F j, Y g:i a', $machine_format);
// Output
Wednesday, February 4, 2015 12:12 am
To control the workstation using x2x:
ssh -XC user@host x2x -[north,east,south,west] -to :0.0
This requires to have x2x installed on the target machine.
@geraldvillorente
geraldvillorente / gist:611c9a3cb9bbcfbf2637
Created March 23, 2015 06:06
How to get the git commit log or changelog
git log --no-merges --pretty=format:"%h - %an, %ar : %s" --since="February 13 2015"