Git push over proxy temperately
Home: 127.0.0.1
Git server whitelisted office IP only
Tab1:
$ ssh -D 2001 office.ip
Opened a socks4 proxy on 127.0.0.1:2001
Tab2:
$ git config --global http.proxy socks4://127.0.0.1:2001
$ git push
$ git config --global --unset http.proxy
Bangkok chatuchak lockers
Weekend landing on Bangkok? Want to head straight to chatuchak shopping and checkin hotel next to save some precious time?
Sadly, there is no luggage locker in chatuchak, but only small lockers for small bags and backpack: http://www.lockbox-th.com/#!Where-is-the-Locker-at-Chatuchak-JJ-market/m...
Really, only the size as seen in above link. You can push your hand carry luggage in. So better checkin and drop your back. Dragging luggage and shopping will make you feels like joined tour de france.
And last, if you are coming for fashion and Thailand handmade, please come during weekend only. Weekday's chatuchak is just like a dead zone and feeling surreal. Except Tuesday afternoon after 3pm, chatuchak will turn into a huge flower market from small table top plants to trees of 2 floors high.
Rsync git diff files to external
git diff -z --name-only HEAD^ HEAD | xargs -0 -IREPLACE rsync -azP REPLACE root@www.example.com:/var/www/html/
oneliner, no need to explain, right?
Alter comments query to order by DESC
Drupal ordinary comment listing under nodes are ordered earliest first.(created ASC)
If you need to make it DESC, without using views:
<?php
/* Implements hook_query_TAG_alter().
https://www.drupal.org/node/1095656#comment-7885467
* * Alter comments query to order by DESC as well as the default ASC. */
function CUSTOM_query_comment_filter_alter(QueryAlterableInterface $query) {
$orderby = &$query->getOrderBy();
$expressions = &$query->getExpressions();
// Sorting for threaded comments.
if (isset($orderby['torder'])) {
// Get rid of the expressions that prepare the threads for ASC ordering.
// Simply order by the thread field.
unset($expressions['torder']);
unset($orderby['torder']);
$orderby['c.thread'] = 'DESC';
}else{ // Sorting for flat comments.
$direction = 'DESC';
if (isset($orderby['c.cid'])) {
unset($orderby['c.cid']);
}
$orderby['c.created'] = $direction;
$orderby['c.cid'] = $direction;
}
}?>
Surprisingly complex. Maybe should just use views...
Adding open graph tags to node page
<?php
//custom.module: function custom_preprocess_node(&$vars) {
drupal_add_html_head(array(
'#tag' => 'meta',
'#attributes' => array(
'property' => 'og:description',
'content' => trim(strip_tags($vars['node']->body['und'][0]['safe_value'])),
),
), 'og_description');
?>