Skip to content

Instantly share code, notes, and snippets.

@nvahalik
nvahalik / quick_test_redirects.php
Last active August 29, 2015 14:19
Quick redirect checker
<?php
/**
* This file provides a quick-n-dirty method for testing redirects.
*
* Just edit the $tests array and run from the CLI.
*
* If you are having problems, try making sure your DNS server is set to
* something that isn't dnsmasq as I had problems with with it while
* running this for a website in development.

Keybase proof

I hereby claim:

  • I am nvahalik on github.
  • I am nvahalik (https://keybase.io/nvahalik) on keybase.
  • I have a public key whose fingerprint is E9F4 1354 E46E B1E4 5C2B 8266 8CEF 0763 AEEB 0BD6

To claim this, I am signing this object:

@nvahalik
nvahalik / copy_product_to_bundle.json
Created April 24, 2014 05:25
This particular set of gists gives you a framework for automating the creation of bundle groups from existing products. The first view is a rule which sets up the product bundle group. The second is a helper which creates a bundle item and ties it to a product. It gets called in a loop in the first rule. The last is an action which can be used t…
{ "rules_copy_product_to_a_bunde" : {
"LABEL" : "Create Bundle from a Product Display",
"PLUGIN" : "rule",
"OWNER" : "rules",
"REQUIRES" : [ "rules" ],
"USES VARIABLES" : { "orig_pbd" : { "label" : "Node as passed", "type" : "node" } },
"IF" : [
{ "entity_has_field" : { "entity" : [ "orig-pbd" ], "field" : "field_product" } }
],
"DO" : [
<?php
$view = new view();
$view->name = 'bundle_entity_reference_display';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'commerce_product';
$view->human_name = 'Bundle Entity Reference Display';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
@nvahalik
nvahalik / custom google apps scripts for tech sales
Last active June 16, 2022 06:17
Some Google Apps Script functions for Spreadsheets which might be useful for those in Technical Sales or software development. They can be used to add up and manipulate hour ranges (e.g. SUMRANGE(["1-2",2,"2-5"]) would yield "5-9"). Those functions are SUMRANGE, SUMRANGEHIGH, SUMRANGELOW, RANGEMULT, and RANGEADD. There are also some functions wh…
/* Grab the values and make them globally available. */
var hoursPerDay = 8;
var hoursPerWeek = hoursPerDay * 5;
/**
* We calculate the number of hours in a given range.
*/
function SUMTIME(allData) {
var numHours = 0;
var numCells = allData.length;