Skip to content

Instantly share code, notes, and snippets.

@tristar500
tristar500 / gist:92576037153a475cb989c2cfd07b77e5
Created June 2, 2017 19:43
FrameMaker - Save to TEXT and PDF
//~ https://forums.adobe.com/message/9544659
//~ https://forums.adobe.com/message/9544924
$.writeln("START **************************************************************");
// This switch just keeps the developer from having to work the select dialog for each test
var production = true;
if(production == true){
var selectedFolder = Folder.selectDialog ("Select Folder with Source Files");
@tristar500
tristar500 / gist:decc8f30d1521aa6f827c61efebefbb3
Created May 31, 2017 15:44
Excel - count items in a comma separated list in a worksheet cell
=LEN(TRIM(A1))-LEN(SUBSTITUTE(TRIM(A1),",",""))+1
//~ https://forums.adobe.com/message/9544659
//~ https://forums.adobe.com/message/9544924
$.writeln("START **************************************************************");
// This switch just keeps the developer from having to work the select dialog for each test
var production = true;
if(production == true){
var selectedFolder = Folder.selectDialog ("Select Folder with Source Files");
@tristar500
tristar500 / gist:abbe77595ff91d79801a
Created May 15, 2014 20:21
Send $_POST using AngularJS
/// ******************************************
///
/// There are crazy gyrations required post data from angular.
/// http://stackoverflow.com/questions/11442632/how-can-i-make-angular-js-post-data-as-form-data-instead-of-a-request-payload
///
/// ******************************************
var xsrf = $.param(selectedItem);
$http({
method: "POST",
url: 'updateuser',
@tristar500
tristar500 / angular-clicktoedit.js
Created May 15, 2014 18:22
Click to Edit Angular Directive
//
//http://icelab.com.au/articles/levelling-up-with-angularjs-building-a-reusable-click-to-edit-directive/
//
// The prepend attribute allows you to add text before the value
//
// <p class="form-control-static" click-to-edit="user.bill_rate" prepend="$"></p>
//
//
app.directive("clickToEdit", function() {
var editorTemplate = '<div class="click-to-edit">' +
@tristar500
tristar500 / CatalogController.php
Last active August 29, 2015 14:00
Zend DB Update
$data = array(
'manual_nm'=>$manual_nm,
'manual_acronym'=>$manual_acronym,
'legacy_carrier_id'=>$legacy_carrier_id,
'department_id'=>$department_id,
'owner_nm'=>$owner_nm,
'collected_dt'=>$collected_dt,
'collected_by'=>$collected_by,
'drive_nm'=>$drive_nm,
'trk_num_txt'=>$trk_num_txt,
@tristar500
tristar500 / gist:11145895
Created April 21, 2014 15:25
new JS Date with PHP formatting
var startDate = new Date('<?php echo date('Y-m-d', strtotime($this->startdate)); ?>');
@tristar500
tristar500 / String to Float.php
Created December 7, 2013 22:52
Convert string value with commas into a float
$val = "1,234,988.56";
$num = floatval(str_replace(",","",$val));
echo $num;
// returns - 1234988.56
@tristar500
tristar500 / new_gist_file.js
Created December 7, 2013 17:13
Build JS object of states
var states = [];
$.each({"AL":"Alabama","AK":"Alaska","AZ":"Arizona","AR":"Arkansas","CA":"California","CO":"Colorado","CT":"Connecticut","DE":"Delaware","FL":"Florida","GA":"Georgia","HI":"Hawaii","ID":"Idaho","IL":"Illinois","IN":"Indiana","IA":"Iowa","KS":"Kansas","KY":"Kentucky","LA":"Louisiana","ME":"Maine","MD":"Maryland","MA":"Massachusetts","MI":"Michigan","MN":"Minnesota","MS":"Mississippi","MO":"Missouri","MT":"Montana","NE":"Nebraska","NV":"Nevada","NH":"New Hampshire","NJ":"New Jersey","NM":"New Mexico","NY":"New York","NC":"North Carolina","ND":"North Dakota","OH":"Ohio","OK":"Oklahoma","OR":"Oregon","PA":"Pennsylvania","RI":"Rhode Island","SC":"South Carolina","SD":"South Dakota","TN":"Tennessee","TX":"Texas","UT":"Utah","VT":"Vermont","VA":"Virginia","WA":"Washington","WV":"West Virginia","WI":"Wisconsin","WY":"Wyoming"}, function(k,v){
states.push({id: k, text: v});
});
@tristar500
tristar500 / States Array
Created June 8, 2013 13:57
States Array
array('' => 'Select', 'AL' => 'Alabama','AK' => 'Alaska','AZ' => 'Arizona','AR' => 'Arkansas','CA' => 'California','CO' => 'Colorado','CT' => 'Connecticut','DE' => 'Delaware','DC' => 'District Of Columbia','FL' => 'Florida','GA' => 'Georgia','HI' => 'Hawaii','ID' => 'Idaho','IL' => 'Illinois','IN' => 'Indiana','IA' => 'Iowa','KS' => 'Kansas','KY' => 'Kentucky','LA' => 'Louisiana','ME' => 'Maine','MD' => 'Maryland','MA' => 'Massachusetts','MI' => 'Michigan','MN' => 'Minnesota','MS' => 'Mississippi','MO' => 'Missouri','MT' => 'Montana','NE' => 'Nebraska','NV' => 'Nevada','NH' => 'New Hampshire','NJ' => 'New Jersey','NM' => 'New Mexico','NY' => 'New York','NC' => 'North Carolina','ND' => 'North Dakota','OH' => 'Ohio','OK' => 'Oklahoma','OR' => 'Oregon','PA' => 'Pennsylvania','RI' => 'Rhode Island','SC' => 'South Carolina','SD' => 'South Dakota','TN' => 'Tennessee','TX' => 'Texas','UT' => 'Utah','VT' => 'Vermont','VA' => 'Virginia','WA' => 'Washington','WV' => 'West Virginia','WI' => 'Wisconsin','WY' => 'Wyoming'