Skip to content

Instantly share code, notes, and snippets.

@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;
<?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 / 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" : [

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 / 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.
@nvahalik
nvahalik / Doxyfile
Created August 21, 2015 17:33
My "standard" Doxyfile which generates super-nice docs.
# Doxyfile 1.8.9.1
# This file describes the settings to be used by the documentation system
# doxygen (www.doxygen.org) for a project.
#
# All text after a double hash (##) is considered a comment and is placed in
# front of the TAG it is preceding.
#
# All text after a single hash (#) is considered a comment and will be ignored.
# The format is:
@nvahalik
nvahalik / dpatch.py
Created December 2, 2015 03:30
Drupal patch maker
#!/usr/local/bin/python
import json
import re
import urllib2
import subprocess
class Issue:
def __init__(self, number):
self.number = number
/*
$type = 'commerce_order_order_confirmation';
$order = commerce_order_load(1);
$message = message_create($type);
$wrapper = entity_metadata_wrapper('message', $message);
$wrapper->message_commerce_order->set($order);
$wrapper->save();
dpm($wrapper->value());
@nvahalik
nvahalik / drupal_request.json
Created November 16, 2016 03:58
Drupal Request lnav format
{
"drupal_request": {
"title": "Drupal Request Format",
"description": "A log record following Acquia's Drupal Request log file format.",
"regex": {
"default": {
"pattern": "\\[(?<timestamp>\\d{2}/\\w{3}/\\d{4}:\\d{2}:\\d{2}:\\d{2} (\\+|-)\\d{4})\\] (?<host>[\\w-\\.]+) (?<method>GET|POST|) (?<url>[\\S]+) http_code=(?<http_code>\\d{3}|) query=(?<query>\\S*) uid=(?<uid>\\d+) php_pid=(?<php_pid>\\d+) php_time=(?<php_time>\\d+\\.?\\d*) queue_wait=(?<queue_wait>-?\\d+) request_id=\"(?<request_id>[\\w-]+)\""
}
},
"opid-field": "uid",
@nvahalik
nvahalik / dpp.md
Last active August 10, 2018 14:59
A basic data protection policy for sub/contractors

Background

We've been trying to codify some ways to convey to people what we do and what we expect them to do regarding how they manage and handle customer-related data. Curious on any thoughts or feedback anyone might have. This is the first draft!

Data Protection Policy

As a contractor for the Company, you agree to undertake the following in the daily course of business:

  • Take all necessary measures to ensure that any source code, client-related data, secrets, etc. will remain in secure storage while they are being worked on.
  • Promptly remove any and all assets for a client in the event of a project becoming terminated or a lapse in work for a client for a period of 6 weeks. This includes and all backups of all client-related data.
  • Encrypt all backups or you will exclude from backups all source code, databases, and assets for each client.