Skip to content

Instantly share code, notes, and snippets.

View dasginganinja's full-sized avatar

Tom Donahue dasginganinja

  • Lehigh University
  • Bethlehem, PA
View GitHub Profile
@dasginganinja
dasginganinja / drush-drupal-7-grant-all-privileges-to-role.php
Last active March 7, 2018 11:03
Drupal 7 Drush Command to Grant All Permission to A Role
<?php
// Get the Role ID we want to add all permissions to
$rid = user_role_load_by_name('Super Administrator')->rid;
// Get a listing of all of the permissions
$perms = array_keys(user_permission_get_modules());
// Grant permissions for the role
user_role_grant_permissions($rid, $perms);
@bitoiu
bitoiu / self-signed-wildcard-cert-for-ghes.md
Last active September 19, 2023 09:37
Self-Signed Wildcard certificate with SAN using openssl / SSL

Copy the default template of openssl.cnf to a writable location.

cp /System/Library/OpenSSL/openssl.cnf src

Uncomment the req_extensions = v3_req

req_extensions = v3_req # The extensions to add to a certificate request

Add subjectAltName to v3_req section

@dasginganinja
dasginganinja / Shipping Rate - PA Tax Component Rules
Last active August 29, 2015 14:28
Drupal Commerce Sales Tax for Taxable Items & Shipping
{ "commerce_tax_rate_pa_sales_tax" : {
"LABEL" : "Calculate PA Sales Tax",
"PLUGIN" : "rule",
"OWNER" : "rules",
"TAGS" : [ "Commerce Tax", "sales_tax" ],
"REQUIRES" : [ "commerce_order", "rules", "commerce_tax" ],
"USES VARIABLES" : { "commerce_line_item" : { "label" : "Line item", "type" : "commerce_line_item" } },
"IF" : [
{ "commerce_order_compare_address" : {
"commerce_order" : [ "commerce-line-item:order" ],
@ajhyndman
ajhyndman / product_options.tpl
Last active April 22, 2017 00:49
Custom Radio Button Options - CS-Cart 4.2
{if $product.tracking == "ProductTracking::TRACK_WITH_OPTIONS"|enum}
{assign var="out_of_stock_text" value=__("text_combination_out_of_stock")}
{else}
{assign var="out_of_stock_text" value=__("text_out_of_stock")}
{/if}
{if ($product.price|floatval || $product.zero_price_action == "P" || $product.zero_price_action == "A" || (!$product.price|floatval && $product.zero_price_action == "R")) && !($settings.General.allow_anonymous_shopping == "hide_price_and_add_to_cart" && !$auth.user_id)}
{assign var="show_price_values" value=true}
{else}
{assign var="show_price_values" value=false}
@wpscholar
wpscholar / vagrant-cheat-sheet.md
Last active April 25, 2024 12:11
Vagrant Cheat Sheet

Typing vagrant from the command line will display a list of all available commands.

Be sure that you are in the same directory as the Vagrantfile when running these commands!

Creating a VM

  • vagrant init -- Initialize Vagrant with a Vagrantfile and ./.vagrant directory, using no specified base image. Before you can do vagrant up, you'll need to specify a base image in the Vagrantfile.
  • vagrant init <boxpath> -- Initialize Vagrant with a specific box. To find a box, go to the public Vagrant box catalog. When you find one you like, just replace it's name with boxpath. For example, vagrant init ubuntu/trusty64.

Starting a VM

  • vagrant up -- starts vagrant environment (also provisions only on the FIRST vagrant up)
@soifou
soifou / install-ut-goty-debian-64bits.md
Last active March 7, 2024 12:26
Install Unreal Tournament GOTY on Debian Jessie 64bits

Install Unreal Tournament GOTY on Debian 64bits

Run natively Unreal Tournament Game Of The Year (GOTY) on Debian system.

UT is not dead! The install process is a bit cumbersome but the game has been published more than 20 years ago! Please let me know how it went for you and if you have any tips, please share :)

And most important, have fun!

(Tested on Debian Bullseye 64bits)

@rgoodie
rgoodie / new-drupal-dev-vm.sh
Last active March 22, 2018 23:47
A function, when added to bash profile, clones the Vagrant Drupal-Dev-VM (https://github.com/geerlingguy/drupal-dev-vm), augments configuration (based on d7 or d8), renames the VM to something other than drupaltest.dev and starts vagrant up. Uses include <newd 7 my-drupal-site> and <newd 8 my-other-drupal-site>.
# new drupal vagrant install
# A function, when added to bash profile, clones the Vagrant Drupal-Dev-VM (https://github.com/geerlingguy/drupal-dev-vm),
# augments config (based on d7 or d8), renames the VM to something other than drupaltest.dev and starts vagrant up. Uses
# include <newd 7 my-drupal-site> and <newd 8 my-other-drupal-site>.
function newd {
if [ $2 == ]; then
echo 'USAGE: newd8 <version> <sitename>'
#!/bin/bash
# Add Vagrant's hostupdater commands to sudoers, for `vagrant up` without a password
# force sudo on self.
if [ $( id -u ) -ne 0 ]; then
exec sudo -p "Login password for %p: " "$0" "$@"
exit $?
fi
# Stage updated sudoers in a temporary file for syntax checking
@aschanMarcus
aschanMarcus / remove_css
Created March 19, 2014 11:07
Remove inline CSS from body fields in Drupal.
/**
* For removing inline CSS from body fields in Drupal.
*
* -Install devel module.
* -Navigate to devel/php.
* -Paste the following code and execute.
*/
$results = db_select('field_data_body', 'f')
->fields('f', array('entity_id', 'body_value'))
@esampaio
esampaio / gulpfile.js
Created March 7, 2014 11:37
Base Gulpfile.js
var gulp = require('gulp');
var clean = require('gulp-clean');
var gutil = require('gulp-util');
var coffee = require('gulp-coffee');
var sass = require('gulp-ruby-sass');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
gulp.task('fonts', function() {
return gulp.src(['bower_components/font-awesome/fonts/fontawesome-webfont.*'])