Skip to content

Instantly share code, notes, and snippets.

View jhyland87's full-sized avatar

J jhyland87

View GitHub Profile
CLI ARGUMENTS
( * = Required for excel parsing and bulk query generation. )
Input Options: Arguments used for importing and parsing the excel sheet.
* -i, --in <file> Excel sheet to parse and use for the macro substitutions in the parsed query. Can be xls or xlsx.
Examples: --in ./foo.xlsx; -i ./foo\ bar.xls
* -q, --query <query> Query "template" to use for the bulk query generation. Place macros in the query to customize it for each row (see "--help macros" for more info)
Example: --query "UPDATE accounts SET accounts.status = '{col:D;d:0}' WHERE account.id = '{col:A}!'"
$ xls2sql -i /Users/jhyland/Documents/scripts/python/work/excel-to-sql/excel-templates/ON-DTS\ Replen\ OFF\ -\ 20-rows.xlsx -q 'UPDATE STOREITEM SET replenish_status = "N" WHERE COMPANYID = 123 AND STOREID = {col:A} AND ITEMID IN ({range:B-*;j:,}!)' --row-start 5
UPDATE STOREITEM SET replenish_status = "N" WHERE COMPANYID = 123 AND STOREID = 532 AND ITEMID IN (118469,117677,118233,118474,118467,116726,116727,116732,116730,117676,117859,117460,116729,119056,117472,116731,117481,117866,117461,117463,117868,117462,117483,117869,117464,117484,117493,118509,118507,117466,118508,117891,117468,117469,118566,118466,118471,118472,118470,118468,117878,118946,118947,118948,118950,117880,118510,117471,117473,117893,117892,117476,117895,117896,117897,117485,118624,118517,117474,117475,117486,118626,117901,117496,117490,117906,117908,118527,118526,117479,117477,117910,117912,117478,117480,117491,117501,118711,118716,118714,118712,118713);
UPDATE STOREITEM SET replenish_status = "N" WHERE COMPANYID = 123 AND STOREID = 773
// src/models/partition.js
'use strict'
import _ from 'moar-lodash'
import Promise from 'bluebird'
import Async from 'async'
import Util from 'util'
import * as AppRoot from 'app-root-path'
import path from 'path'
function curlcmd() {
method=${1:-GET}
method=$(echo $method | tr '[a-z]' '[A-Z]')
/usr/bin/curl -X ${method} -i --header 'Accept: application/json' ${@:2} && echo
}
alias cjpost="curlcmd post"
alias cjget="curlcmd get"
module.exports = Mongoose => {
const Schema = Mongoose.Schema
const modelSchema = new Schema({
name: {
type: Schema.Types.String,
trim: true
},
description: Schema.Types.String
}, {
'use strict'
// Used for makeHash
//const crypto = require('crypto')
import _ from 'moar-lodash'
import Promise from 'bluebird'
import Async from 'async'
import Util from 'util'
<?php
/**
* @link https://www.if-not-true-then-false.com/2010/php-class-for-coloring-php-command-line-cli-scripts-output-php-output-colorizing-using-bash-shell-colors/
* @author (original) JR
* @method Str val( string $val ) Creates new string modifier
* @method Str fg( string $fg ) Font foreground color
* @method Str bg( string $bg ) Font background color
* @method Str st( string $st ) Font style (italic, bold, etc)
* @method string __toString() Outputs modified string
<?php
$to_iterate = get_defined_constants();
function do_filter($k) {
if(count($argv)){
array_pop($argv);
$pattern = '/^('.implode($argv,'|') .')_/i';
return preg_match( $pattern, $k ) > 0;
@jhyland87
jhyland87 / style-guide.js
Last active September 30, 2016 15:41 — forked from rwaldron/style-guide.js
Writing Idiomatic JavaScript
// 1. Two space soft indents (fake tabs) OR tabs... BUT NEVER BOTH - DO NOT MIX
// 2. Whitespace, Parens, Braces, Linebreaks
// if/else/for/while/try always have spaces, braces and multiple lines.
--------------------------------------------------------------------
'use strict';
var _appRootPath = require('app-root-path');
var appRoot = _interopRequireWildcard(_appRootPath);
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
var Controllers = appRoot.require('/dist/controllers');