Skip to content

Instantly share code, notes, and snippets.

// Load dataset via custom BAQ
using (var session = new Epicor.Mfg.Core.Session("user", "secret", "AppServerDC://server:port"))
{
// DynamnicQuery for BAQ
var dynamicQuery = new Epicor.Mfg.BO.DynamicQuery(session.ConnectionPool);
// Get named BAQ
var queryDesignDataSet = dynamicQuery.GetByID("01-BAQName");
// Execute and store
// Execute BAQ with parameter
using (var session = new Epicor.Mfg.Core.Session("user", "secret", "AppServerDC://server:port"))
{
// DynamnicQuery for BAQ
var dynamicQuery = new Epicor.Mfg.BO.DynamicQuery(session.ConnectionPool);
// Build Parameters DS
QueryExecutionDataSet executionDS = new QueryExecutionDataSet();
// Actual parameter row
@jlewin
jlewin / dumpToDiskViaFileSystemAPI.js
Last active December 10, 2015 19:29
Using the FileSystem/File API to dump page contents
// Customized version of the FileSystem API examples described at http://www.html5rocks.com/en/tutorials/file/filesystem/
// - Primarily used to dump the microdata example content protrayed in http://www.w3.org/html/wg/drafts/microdata/master/
// - Runs on any page containing one or more pre elements, but assumes that jQuery has been loaded as either part of the
// page or after the fact via jQuerify.
// - On Windows 8, the resulting files appear to be created in "%LOCALAPPDATA%\Google\Chrome\User Data\Default\File System"
// Example: C:\Users\<userName>\AppData\Local\Google\Chrome\User Data\Default\File System\001\p\00
// Define the success callback for webkitRequestFileSystem()
function onInitFs(fs) {
@jlewin
jlewin / runLiveMicrodataTestsInW3draftText.js
Last active December 10, 2015 20:28
Console hijacking the W3C Microdata draft document http://www.w3.org/html/wg/drafts/microdata/master/ to provide parser results inline with the draft examples. Currently works by passing pre contents to a local http server that runs the data through the specified parser and returns the results as serialized JSON.
var halfWidth = { width: '45%', float: 'left', background: '#ccc', margin: '10px 0', padding: '5px', 'border-right': 'solid 1px #aaa' };
$('pre').css(halfWidth).each(function () {
var $pre = $(this);
$.ajax({
url: 'http://localhost:50231/api/hello',
data: { markup: $pre.text() , uri: window.location.href, impl: ''},
dataType: 'json',
success: function(result) {
(function () {
var el = document.createElement('div'),
b = document.getElementsByTagName('body')[0],
otherlib = false;
// Message window element
el.style.position = 'fixed';
el.style.height = '32px';
el.style.width = '220px';
el.style.marginLeft = '-110px';
@jlewin
jlewin / readme.md
Last active December 10, 2015 20:58 — forked from johan/readme.md
**Fork Details** A quick and dirty update to refactor for the December 2012 site changes and well as account for the use of pjax, which happens to bypass userscript invocation for all urls except on page reloads. As such, a MutationObserver is registered to identify when pjax requests reload the #js-pjax-container and button injection logic is r…
@jlewin
jlewin / parseYouTubeTranscript.js
Last active December 10, 2015 23:28
Extract a quote from YouTube transcripts
// Usage: Open the transcript view, select the line to start at, and call getQuoteFromVideo
// passing it just the number of lines to collect
// or
// Call getQuoteFromVideo passing it the number of lines to collect and an element id to start at
function getQuoteFromVideo(count, captionStartID){
var captionLine = document.querySelector(captionStartID || '.caption-line-highlight');
var text = '';
for(var i = 0; i < count && captionLine; i++){
text += captionLine.querySelector('.caption-line-text').textContent + ' ';
@jlewin
jlewin / parseRdioHistory1.js
Last active December 11, 2015 00:59
Hacking on Rdio History to debug gross misreporting of play count
var sources = results.result.sources;
for(var i = 0; i < sources.length; i++)
{
var item = sources[i];
console.log(item.source.artist, '-', item.source.name);
console.group();
var tracks = item.tracks.items;
for(var j = 0; j < tracks.length; j++)
@jlewin
jlewin / parseRdioHistory2.js
Last active December 11, 2015 00:59
More Rdio History work
var allResults = [ /* get json from fiddler requests */];
for (var a = 0; a < 3; a++) {
var sources = allResults[a].result.sources;
//console.log(sources);
console.log('---------------------------------')
for (var i = 0; i < sources.length; i++) {
var item = sources[i];
console.log();
// Of note: it took a while to discover why $('.wikitable tr').eq(0).siblings() was null but I finally
// noticed and accounted for the thead/tbody elements
$('.wikitable tbody tr').each(function() { if($(this).text().indexOf('2560') == -1) $(this).hide()});