Skip to content

Instantly share code, notes, and snippets.

Avatar

John Vilsack johnvilsack

View GitHub Profile
@johnvilsack
johnvilsack / GAS-RowScoping
Created Aug 22, 2019
GAS- Full Row Scoping
View GAS-RowScoping
// This script runs every time a cell is changed
function onEdit(e) {
var thisSheet = SpreadsheetApp.getActiveSheet();
var editedCell = e.range.getA1Notation();
var editedRow = e.range.getRow();
var editedCol = e.range.getColumn();
var editedA1Col = columnToLetter(editedCol);
// @@ DEBUG
thisSheet.getRange('I10').setValue(editedCell);
View GAS-setEvalRow.js
// This is the code to edit
function evalRow(thisSheet, editedRow) {
// EDIT THE COLUMNS HERE TO CHANGE WHICH ROWS ARE IN ARRAY
var watchedRange = "A"+editedRow+":E"+editedRow;
var rowArray = thisSheet.getRange(watchedRange);
var rowValues = rowArray.getValues();
// @@ DEBUG
@johnvilsack
johnvilsack / GAS-columnToLetter.js
Created Aug 21, 2019
GAS: Column to A1 and Back Again
View GAS-columnToLetter.js
// Fixes SMALL oversight of not being able to work with A1 notation
function columnToLetter(column)
{
var temp, letter = '';
while (column > 0)
{
temp = (column - 1) % 26;
letter = String.fromCharCode(temp + 65) + letter;
column = (column - temp - 1) / 26;
}
@johnvilsack
johnvilsack / gas-onedit.js
Created Aug 21, 2019
GAS: onEdit Instantiation
View gas-onedit.js
// This script runs every time a cell is changed
function onEdit(e) {
var thisSheet = SpreadsheetApp.getActiveSheet();
var editedCell = e.range.getA1Notation();
var editedRow = e.range.getRow();
var editedCol = e.range.getColumn();
var editedA1Col = columnToLetter(editedCol);
// @@ DEBUG
@johnvilsack
johnvilsack / index.js
Last active Aug 29, 2015
Standard Index for ActiveScan index.js
View index.js
function onConnectivityChange(state) {
console.log("Connection is: " + state);
}
function onBarcodeScanned(data) {
console.log(data.barcode);
}
var app = {
initialize: function() {
@johnvilsack
johnvilsack / index.js
Created Jul 30, 2015
Standard index.js for /ttatarinov/lineapro-phonegap-plugin
View index.js
function onDeviceConnected(data) {
alert("onDeviceConnected: " + data);
}
function onSuccessScanPaymentCard(data) {
alert("onSuccessScanPaymentCard: " + data);
}
function onBarcodeScanned(data) {
alert("onBarcodeScanned: " + data.rawCodesArr);
@johnvilsack
johnvilsack / ClientSide CSV Rendering (Drag and Drop) Version
Created Jul 23, 2015
Drag and drop target that uses Papaparse to read a JSON file into an object; all client side.
View ClientSide CSV Rendering (Drag and Drop) Version
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<style>
html {margin-top:40px;}
</style>
</head>
View InventoryPull
SELECT
RTRIM(ITEM_ID) AS ITEM_ID
FROM INVENTOR
WHERE
(
ENTRY_DATE >= '2015-01-01'
OR
(AVAILABLE > 0 OR ON_ORDER_QTY > 0 OR COMMITTED_QTY > 0)
)
AND
@johnvilsack
johnvilsack / CONNECTSHIP_ORDERINFO
Created Jul 8, 2015
SQL View of ConnectShip order data
View CONNECTSHIP_ORDERINFO
SELECT
dbo.SYSOENT.ORDER_STATUS,
dbo.SHIPTO.SHIPTO_ID,
dbo.SHIPTO.ORDER_NO,
RTRIM(dbo.SHIPTO.SHIPMETH_CODE) AS SHIPMETH_CODE,
RTRIM(dbo.SHIPTO.COMPANY_NAME) AS SHIPTO_COMPANY_NAME,
RTRIM(dbo.SHIPTO.LAST_NAME) AS SHIPTO_LAST_NAME,
RTRIM(dbo.SHIPTO.FIRST_NAME) AS SHIPTO_FIRST_NAME,
RTRIM(dbo.SHIPTO.ADDRESS_LINE1) AS SHIPTO_ADDRESS_LINE1,
View gist:d401a52c6671c2450985
// Use the package, HTTP.
var http = require('http');
// In the package HTTP, execute createServer
http.createServer(function (req, res) {
// When createServer sees a request, shoot a header with a status 200 (this means OK) and tell it the next bit is text/plain
res.writeHead(200, {'Content-Type': 'text/plain'});
// This is the bits that go to the browser
You can’t perform that action at this time.