Skip to content

Instantly share code, notes, and snippets.

@mbutsko
mbutsko / mymodule.drush.inc
Created January 9, 2012 22:00 — forked from halcyonCorsair/mymodule.drush.inc
Ugly as sin module to override drupal directory creation on install...broken for migrate though
<?php
/**
* Implementation of hook_provision_drupal_create_directories().
*
* Make the directory create phase of a site install web cluster ready.
* A patch to provision is needed.
* @url http://drupal.org/files/issues/provision_drupal_create_directories.patch
*/
function mymodule_provision_drupal_create_directories(&$dirs, $url) {
$web_group = d('@server_master')->web_group;
@mbutsko
mbutsko / mymodule.drush.inc
Created January 9, 2012 22:00 — forked from halcyonCorsair/mymodule.drush.inc
Ugly as sin module to override drupal directory creation on install...broken for migrate though
<?php
/**
* Implementation of hook_provision_drupal_create_directories().
*
* Make the directory create phase of a site install web cluster ready.
* A patch to provision is needed.
* @url http://drupal.org/files/issues/provision_drupal_create_directories.patch
*/
function mymodule_provision_drupal_create_directories(&$dirs, $url) {
$web_group = d('@server_master')->web_group;
@mbutsko
mbutsko / invalid_use_of_token_replace-1327960-8.patch
Created January 23, 2012 20:16
invalid_use_of_token_replace-1327960-8.patch
diff --git a/custom_breadcrumbs.module b/custom_breadcrumbs.module
index a409b53..f2dd185 100644
--- a/sites/all/modules/custom_breadcrumbs/custom_breadcrumbs.module
+++ b/sites/all/modules/custom_breadcrumbs/custom_breadcrumbs.module
@@ -369,8 +369,12 @@ function _custom_breadcrumbs_get_breadcrumb($breadcrumb, $objs, &$locations) {
if (module_exists('token')) {
// Do token replacement.
$types = custom_breadcrumbs_token_types($objs);
- $titles = token_replace_multiple($titles, $types);
- $paths = token_replace_multiple($paths, $types);

Keybase proof

I hereby claim:

  • I am mbutsko on github.
  • I am mbutsko (https://keybase.io/mbutsko) on keybase.
  • I have a public key whose fingerprint is CC43 0BD7 2625 D97F FF2E 5DDC 37CE 27EB 1AAF 3AE7

To claim this, I am signing this object:

<cfif abiliest LTE -3>
<cfset infoforselection = info_3>
<cfelseif abiliest LT -2>
<cfset infoforselection = (1 - (abiliest-(-3))) * info_3 + (1-((-2) - abiliest)) * info_2>
<cfelseif abiliest LT -1>
<cfset infoforselection = (1 - (abiliest-(-2))) * info_2 + (1-((-1) - abiliest)) * info_1>
<cfelseif abiliest LT 0>
<cfset infoforselection = (1 - (abiliest-(-1))) * info_1 + (1-((+0) - abiliest)) * info0>
<cfelseif abiliest LT 1>
<cfset infoforselection = (1 - (abiliest-(+0))) * info0 + (1-((+1) - abiliest)) * info1>
#!/bin/bash
if [ -e $1 ]; then
if [ `head -c2 $1` == '//' ]; then
sed -i 's/^\/\///g' $1
else
sed -i 's/^/\/\//g' $1
fi
fi
@mbutsko
mbutsko / workout peg
Created June 23, 2017 00:01
Basic PEG for Workouts
workout = exercise+
exercise = exercise:word ": " sets:integer "x" reps:integer "\n"? { return { exercise: exercise.join(''), sets: sets, reps: reps } }
word = [A-Za-z]+
integer = [0-9]
@mbutsko
mbutsko / tables.html
Created January 31, 2018 14:06
Table Width Calculation is Weird
<html>
<head>
<style>
table {
width: 100%;
}
th, td {
border: 1px solid black;
}
account_id = '4bae2dcd-fc39-4aad-b5b2-b3dcc562995a'
account = Account.find(account_id)
policy = PolicyService.current_policy(:account_id => account.id)
base_quote = policy.active_term.quote
new_profile = ProfileService.update(policy.profile, []).profile
profile_rating_data = EndorsementService.endorsement_profile_rating_data(
:account_id => account_id,
@mbutsko
mbutsko / go.rb
Last active June 4, 2020 16:37
Reactivate improperly deactivated scheduled closure endorsements
sql = "
with latest_scheduled_closure_endorsements as ( SELECT * FROM ( select ptr.*, DENSE_RANK() OVER newest_first FROM scheduled_closure_endorsements ptr WINDOW newest_first as (PARTITION BY ptr.policy_term_id ORDER BY ptr.created_at DESC)) _ WHERE DENSE_RANK = 1)
, latest_policy_term_revisions as ( SELECT * FROM ( select ptr.*, DENSE_RANK() OVER newest_first FROM policy_term_revisions ptr WINDOW newest_first as (PARTITION BY ptr.policy_term_id ORDER BY ptr.created_at DESC)) _ WHERE DENSE_RANK = 1)
select sce.id from latest_scheduled_closure_endorsements sce
join policy_term_revisions ptr on ptr.quote_id=sce.quote_id
and ptr.revision_type='endorsement' -- Because you could have reinstated directly on to your target
join scheduled_closure_endorsement_policy_payment_amounts sceppa on sceppa.scheduled_closure_endorsement_id=sce.id
join policy_payment_amounts ppa on ppa.id=sceppa.policy_payment_amount_id