Skip to content

Instantly share code, notes, and snippets.

// ==UserScript==
// @name Suspend Disable-Devtool (simple approach)
// @namespace https://www.tampermonkey.net/
// @version 0.1
// @description suspend https://github.com/theajack/disable-devtool
// @author hussainweb
// @match {site}
// @icon https://www.google.com/s2/favicons?sz=64&domain=gist.github.com
// @grant none
// ==/UserScript==
@hussainweb
hussainweb / download-recordings.py
Last active June 10, 2021 17:42
Download Recordings from Zoom using a JWT token
#!/usr/bin/env python3
from datetime import date, datetime
import json
from pathlib import Path
import os
import sys
from urllib.request import Request, urlopen, urlretrieve
<?php
// in src/Form directory.
namespace Drupal\mymodule\Form;
use Drupal\Core\Form\FormStateInterface;
use Drupal\system\Form\SiteInformationForm;
/**
@hussainweb
hussainweb / import-xhprof-to-xhgui.php
Last active July 15, 2021 09:49
Import XHProf runs into xhgui
<?php
// Run this as follows:
// php import-xhprof-to-xhgui.php -d /dir/to/xhprof/runs/
//
// Based on https://github.com/perftools/xhgui/blob/master/external/import.php
if (!defined('XHGUI_ROOT_DIR')) {
require __DIR__ . '/src/bootstrap.php';
}
@hussainweb
hussainweb / .gitlab-ci.yml
Created January 23, 2020 00:23
Gitlab CI DTT integration
drupal_tests:
image: hussainweb/drupal-base:php7.3
services:
- mariadb:10.3
stage: test
tags:
- autoscaler
variables:
SITE_BASE_URL: 'http://localhost'
MYSQL_DATABASE: "drupal"
@hussainweb
hussainweb / TextAdsBlock.php
Last active February 3, 2020 23:43
A Drupal 8 block plugin which needs to be shown only on node pages (using context)
<?php
namespace Drupal\my_module\Plugin\Block;
use Drupal\Core\Access\AccessResult;
use Drupal\Core\Block\BlockBase;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\Core\Session\AccountInterface;
use Drupal\node\NodeInterface;
use Drupal\my_module_lists\ProfilesService;
@hussainweb
hussainweb / TopicsSelection.php
Created December 12, 2019 23:43
/web/modules/custom/axl_ks_topics/src/Plugin/EntityReferenceSelection/TopicsSelection.php
<?php
namespace Drupal\axl_ks_topics\Plugin\EntityReferenceSelection;
use Drupal\Component\Utility\Html;
use Drupal\Core\Database\Connection;
use Drupal\Core\Entity\EntityReferenceSelection\SelectionPluginBase;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Entity\Query\QueryInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
@hussainweb
hussainweb / clean-environments.php
Last active December 3, 2019 23:09
Find out what environments can be cleared from platform.sh
#!/usr/bin/env php
<?php
$environments = explode("\n", `platform environments --columns=title,status --format=tsv --no-header | grep -v "\tInactive" | awk "{print \\$1}"`);
$remote_branches = explode("\n", `git ls-remote --heads | awk "{ print \\$2 }" | sed 's/refs\\/heads\\///'`);
$environments = \array_diff($environments, [
"Master",
"develop",
"qa",
@hussainweb
hussainweb / .gitlab-ci.yml
Last active November 21, 2019 13:54
Gitlab CI definition for platform.sh deployment
stages:
- build
- test
- deploy
platformsh:
image: axelerant/platformsh-cli:latest
before_script:
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
- eval $(ssh-agent -s)

Keybase proof

I hereby claim:

  • I am hussainweb on github.
  • I am hussainweb (https://keybase.io/hussainweb) on keybase.
  • I have a public key whose fingerprint is 810B 0D86 29F3 A550 98AF 3015 E1CE 9844 7E2C 7887

To claim this, I am signing this object: