Skip to content

Instantly share code, notes, and snippets.

To quickly and easily remove all unwanted comments when using Sublime text, perform a search and replace (CMD, ALT & D) and enter the following. Make sure that regex search is enabled by clicking the small icon in the bottom left that looks like an astrix.

For example, to remove all HTML comments:

(?s)<!--.*?-->

search and replace with blank

Or to remove all CSS comments:

@ss81
ss81 / remove_input_number_scroll.js
Created March 4, 2020 10:27 — forked from JaisonBrooks/remove_input_number_scroll.js
Disable Input[type=number] scroll action
// Disable Mouse scrolling
$('input[type=number]').on('mousewheel',function(e){ $(this).blur(); });
// Disable keyboard scrolling
$('input[type=number]').on('keydown',function(e) {
var key = e.charCode || e.keyCode;
// Disable Up and Down Arrows on Keyboard
if(key == 38 || key == 40 ) {
e.preventDefault();
} else {
return;
@ss81
ss81 / Local PR test and merge.md
Created May 30, 2019 17:17 — forked from adam-p/Local PR test and merge.md
Testing a pull request, then merging locally; and avoiding TOCTOU

It's not immediately obvious how to pull down the code for a PR and test it locally. But it's pretty easy. (This assumes you have a remote for the main repo named upstream.)

Getting the PR code

  1. Make note of the PR number. For example, Rod's latest is PR #37: Psiphon-Labs/psiphon-tunnel-core#37

  2. Fetch the PR's pseudo-branch (or bookmark or rev pointer whatever the word is), and give it a local branch name. Here we'll name it pr37:

$ git fetch upstream pull/37/head:pr37
@ss81
ss81 / hide-rows.js
Created July 22, 2015 15:57
Show only table rows with required value.
jQuery('#block-system-main table:not(.sticky-header) tr').each(function(){
if (jQuery(this).text().indexOf('Term reference (module: Taxonomy)') == -1) {
jQuery(this).hide();
}
});
@ss81
ss81 / example.php
Last active August 29, 2015 14:25 — forked from Luxian/example.php
Check what nodequeues are used in views
<?php
/**
* Check what nodequeues are used in views
*
* Usage:
* drush ev "luxian_nodequeue_stats();"
*/
function luxian_nodequeue_stats() {
if (!drupal_is_cli()) {
@ss81
ss81 / gist:7e0773ad942d8c2be82f
Last active August 29, 2015 14:03
Defining Custom Field Types in Drupal
<?php
/**
* Implements hook_field_schema().
*/
function license_plate_field_schema($field) {
return array(
'columns' => array(
'plate_number' => array(
'type' => 'varchar',
$('body').css('cursor', 'wait');
$('body').css('cursor', 'default');
@ss81
ss81 / gist:9098276
Created February 19, 2014 18:25
Drupal.equalHeight
Drupal.equalHeight = function(group) {
if ($(group).length > 0) {
var tallest = 0, thisHeight = 0;
$(group).each(function() {
thisHeight = $(this).height();
if (thisHeight > tallest) {
tallest = thisHeight;
}
});
@ss81
ss81 / gist:9056554
Created February 17, 2014 18:48
Remove those Word copy and paste smart quotes
function _lym_sanitize_text($text) {
$text = mb_convert_encoding($text, 'HTML-ENTITIES', 'UTF-8');
$find[] = '“'; // left side double smart quote
$find[] = '”'; // right side double smart quote
$find[] = '‘'; // left side single smart quote
$find[] = '’'; // right side single smart quote
$find[] = '…'; // elipsis
$find[] = '—'; // em dash
$find[] = '–'; // en dash
@ss81
ss81 / gist:7222483
Created October 29, 2013 20:59
Initiate Django development environment
virtualenv django_env
cd django_env/
source bin/activate
pip install -r requirements/common.txt
pip install -r requirements/dev.txt
.....
deactivate