Skip to content

Instantly share code, notes, and snippets.

View ranqiangjun's full-sized avatar
🏠
Working from home

Qiangjun Ran ranqiangjun

🏠
Working from home
View GitHub Profile
@ranqiangjun
ranqiangjun / render_menu.php
Created January 13, 2016 07:58 — forked from eugene-ilyin/render_menu.php
Render menu programmatically in Drupal 7
// One level menu.
$menu = menu_tree('main-menu');
$menu_items = render($menu);
// Menu with many levels.
menu_tree_all_data('main-menu');
$menu = menu_build_tree('main-menu');
$menu_items = render(menu_tree_output($menu));

Contribution setup instructions

Fork DrupalConsole

Fork your own copy of the DrupalConsole repository to your account

Clone

Get a copy of your recently cloned version of console in your machine.

$ git clone [email protected]:[your-git-user-here]/DrupalConsole.git
@ranqiangjun
ranqiangjun / vpnguide.md
Last active January 7, 2017 03:01
Setting up a private OpenVPN server [Linux users only]

Setting up a private OpenVPN server [Linux users only]

@ranqiangjun
ranqiangjun / my_sacrifice.md
Created March 26, 2017 00:11
The motherf*cking way the get Oracle access in PHP5 over Ubuntu
@ranqiangjun
ranqiangjun / gist:def7c18003c351c2f747ea95f070279e
Created March 28, 2017 00:09 — forked from senko/gist:2988592
Easy VirtualBox VM handling for the command line
#!/bin/bash -e
#
# Easy VirtualBox VM handling from the command line
BASE_TEMPLATE="<uid-of-template-vm>"
function show_help() {
echo "Usage: $0 [cmd]"
echo "Valid commands:"
echo " list List available virtual machines"

Overview

If you are in a location that allows SSH but doesn't allow access to GitHub (I'm looking at you India), here's an easy way to get around it.

Prerequisites

  1. You need a shell account on a network that doesn't filter GitHub. Ideas for that:
    1. Pay but Cheap: A micro instance on EC2 http://aws.amazon.com/ec2/pricing/
    2. Free-ish: One of the free shell solutions http://shells.red-pill.eu/
  2. The shell account will need access to the netcat binary called nc http://nc110.sourceforge.net/
@ranqiangjun
ranqiangjun / webdev_online_resources.md
Created January 14, 2019 04:32 — forked from rubenribeiro/webdev_online_resources.md
Online Resources For Web Developers (No Downloading)
@ranqiangjun
ranqiangjun / extension-patterns.md
Created January 14, 2023 16:59 — forked from bojanz/extension-patterns.md
Extension patterns: events, tagged services, plugins

This documentation is destined for drupal.org. Created first as a gist to make initial comments easier. Rewrites and clarifications welcome. Code samples are simplified for clarity. Perhaps a bit too much?

When talking about extensibility, there are several distinct use cases:

  1. Reacting to an action that has already happened.

The reaction can be anything; outputting a message, sending an email, modifying a related object, etc. Examples:

  • "A node has been saved"
  • "A product has been added to the cart".