Skip to content

Instantly share code, notes, and snippets.

View wesruv's full-sized avatar
🤔
Why can I have a status?

wesruv wesruv

🤔
Why can I have a status?
View GitHub Profile
@jdillick
jdillick / generate-strongarms.php
Last active August 29, 2015 13:56
Drush script to generate strongarm variables module for a site
<?php
$args = drush_get_arguments();
if ( ! isset($args[2]) ) {
drush_set_error('Usage: drush @<alias> scr generate-strongarm.php <module_name> <base_path>');
exit();
}
$module_name = $args[2];
if ( ! isset($args[3]) ) {
@naxoc
naxoc / pre-commit
Created November 26, 2012 21:05
Drupal git commit hook
#!/usr/bin/php
<?php
/**
* @file
* This is a Git pre-commit hook that informs you when you are
* about to commit whitespace or a debug function.
*/
$red = "\033[1;31m";
$red_end = "\033[0m";
@jdillick
jdillick / aliases.drushrc.php
Last active December 24, 2015 02:39
Dynamic drush aliases. Just modify $paths to include the directory to your drupal installs, and you have instant aliases.
<?php
// the current environment
$env = $_ENV['ENVTYPE'] ? $_ENV['ENVTYPE'] : '';
// paths to search for drupal sites
$paths = array(
'/var/www/multisites/',
'/var/www/schoolyard/',
);
@jibran
jibran / .eslintrc
Last active July 19, 2017 12:14
Sample eslint file for Drupal 7
{
"env": {
"browser": true
},
"globals": {
"Drupal": true,
"jQuery": true,
"tinyMCE": true
},
"rules": {
@eugene-ilyin
eugene-ilyin / render_menu.php
Last active October 26, 2017 23:47
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));
@JustAdam
JustAdam / drupal_taxonomy_content_type.php
Created August 2, 2012 09:49
Drupal 7 - Programmatically create a taxonomy and attach a field to it, then create a content type and attach that taxonomy to it.
<?php
// Machine name for our custom node
define('NODE_NAME', 'the_node_machine_name');
// Machine name for our custom taxonomy
define('TAXONOMY_NAME', 'the_taxonomy_machine_name');
function module_install() {
_create_taxonomy();
_create_content_type();
}
@paceaux
paceaux / queryCSSProperty
Last active October 19, 2020 17:16
Get all CSS selectors containing a particular CSS property
/** queryCSSByPropertyName
* queries the CSSOM looking for CSS rulesets containing a particular CSS property.
* @param {string} queryPropName CSS property name
* @param {string} queryPropValue value of CSS property
* @returns Map with key as CSS selector, value as CSS properties.
*/
function queryCSSByProperty(queryPropName, queryPropValue) {
const styleSheets= document.styleSheets; // get all the stylesheets
const properties = new Map(); // set up the variable that'll store our result
@wesruv
wesruv / cheatsheet.md
Last active May 20, 2022 22:50
Linux CLI Beginner Cheatsheet

Basics

Here's some Linux (particularly Ubuntu) Command Line Interface (CLI) basics

# Command for listing files
ls

# Shows all files and in a nicer layout with the options l and a
ls -la
@wesruv
wesruv / 1_creating-vm.md
Created January 21, 2023 18:27
Creating a LAMP local dev environment with Virtualbox

Creating a Virtualbox Linux VM for local LAMP dev

Download and Install Virtualbox

https://www.virtualbox.org/wiki/Downloads Choose the version for the host machine, so if you’re on Windows, choose that, if Mac, choose that.

Download Ubuntu Server

@jeromecoupe
jeromecoupe / webstoemp-gulpfile.js
Last active January 21, 2024 16:28
Gulp 4 sample gulpfile.js. For a full explanation, have a look at https://www.webstoemp.com/blog/switching-to-gulp4/
"use strict";
// Load plugins
const autoprefixer = require("autoprefixer");
const browsersync = require("browser-sync").create();
const cp = require("child_process");
const cssnano = require("cssnano");
const del = require("del");
const eslint = require("gulp-eslint");
const gulp = require("gulp");