Skip to content

Instantly share code, notes, and snippets.

View nickgs's full-sized avatar
👋

Nick Selvaggio nickgs

👋
  • Sego Solutions, LI Blockchain
  • Long Island
  • X @direct
View GitHub Profile
@nickgs
nickgs / gist:7649863
Created November 25, 2013 22:13
Landed cost item allocation
//our landed costs
ocn = 1000
fsc = 75
//our material cost
material_cost = 1000
unit_landed = (ocn / material_cost) + (fsc / material_cost); //this summation would loop for each cost code.
//unit_landed will be $1.075 a unit in this example.
//let drush have some memory.
if (drupal_is_cli()) {
ini_set('memory_limit', '2048M');
}
@nickgs
nickgs / watchdog.sublime-snippet
Created May 7, 2015 03:28
Drupal Watchdog Sublime Snippet
<snippet>
<tabTrigger>dlog</tabTrigger>
<content><![CDATA[
watchdog('${TM_FILENAME/([^.]*)\..*$/$1/}', '${1}Mylog %data', array('%data' => ${2}), ${3}WATCHDOG_ERROR, ${4}null);
]]></content>
</snippet>
@nickgs
nickgs / gist:39477a72cdcd6743e6e1
Last active August 29, 2015 14:22
ADbuilder Embed Code
<a href="http://www.adctoday.com/diagnostix/embed" target="_blank" onClick="window.open(this.href,'mywindow','width=920,height=700,resizable=yes,location=no,scrollbars=yes'); return false;"><img src="http://www.adctoday.com/sites/default/files/embed_button.png"></a>
@nickgs
nickgs / gist:2cddb29576e9343be9b5
Created July 21, 2015 18:37
Example of building a link from an text field.
//example of building a link from an text field.
$nid = 1;
$node = node_load($nid);
$field = field_get_items('node', $node, 'field_link');
$link = array(
'#theme' => 'link',
'#text' => $field[0]['safe_value'],
'#path' => $field[0]['safe_value'],
'#options' => array(
### Keybase proof
I hereby claim:
* I am nickgs on github.
* I am nickgs (https://keybase.io/nickgs) on keybase.
* I have a public key whose fingerprint is 030E 3C42 3D23 3948 CF5B D186 CF31 48D2 87E5 915F
To claim this, I am signing this object:
@nickgs
nickgs / blocks1.php
Last active September 8, 2015 21:30
Quick and dirty example of how one may split the block implementation to multiple files
<?php
function myblock1() {
$blocks = array();
$blocks['myblock1'] = array(
'info' => t("Block 1"),
);
//...
@nickgs
nickgs / gist:cdc2870ca48951ef1149
Created February 11, 2016 14:57
ADbuilder Embed Code
<a href="http://www.adctoday.com/diagnostix/embed" target="_blank" onClick="window.open(this.href,'mywindow','width=920,height=700,resizable=yes,location=no,scrollbars=yes'); return false;"><img src="http://www.adctoday.com/sites/default/files/embed_button.png"></a>
$conf['mail_system'] = array(
'default-system' => 'DevelMailLog',
);
$conf['devel_debug_mail_directory'] = '/tmp/develmail';
Verifying my Blockstack ID is secured with the address 19pMr7PMm8bVyCeCN7xbNbmxfpiqH51k8n https://explorer.blockstack.org/address/19pMr7PMm8bVyCeCN7xbNbmxfpiqH51k8n