Skip to content

Instantly share code, notes, and snippets.

@salcosta
salcosta / Test
Last active December 22, 2015 12:19
ServiceNow
// table=sys_ui_script
// name=test
// field = script
@salcosta
salcosta / pattern_custom_element
Last active December 22, 2015 12:28
This file is a template for creating a custom element to be using in a ServiceNow form.
<?xml version="1.0" encoding="utf-8" ?>
<!--
___________________________________________________
| |
| Fruition App Accelerator - V1.0 - 09/03/13 |
| http://www.fruitionpartners.com |
| |
| Copyright (c) 2013 Fruition Partners |
| Dual licensed under the MIT and GPL licenses. |
|___________________________________________________|
@salcosta
salcosta / AngularUtilsProcessor
Last active December 4, 2019 04:06
AngularUtilsProcessor
gs.include("esprima");
var AngularUtilsProcessor = Class.create();
AngularUtilsProcessor.prototype = {
initialize: function(g_request, g_processor) {
this.g_request = g_request;
this.g_processor = g_processor;
@salcosta
salcosta / sample_chart.html
Created December 13, 2017 06:31
ServiceNow ChartJS example
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.3/css/font-awesome.min.css"></link>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.7/css/materialize.min.css"></link>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"></link>
<g:evaluate>
var rawData = [];
var incident = new GlideRecord('incident');
@salcosta
salcosta / index.html
Created March 6, 2018 04:50
Single Page App Example using jQuery
<!DOCTYPE html>
<html>
<head>
<title></title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0/css/bootstrap.css" />
<style>
main{
margin-top:60px;
}
</style>
@salcosta
salcosta / EEX Example.yaml
Created September 20, 2018 02:20
Shared with Script Lab
name: EEX Example
description: ''
author: salcosta
host: EXCEL
api_set: {}
script:
content: |
$("#run").click(() => tryCatch(run));
async function run() {
@salcosta
salcosta / handlebars-script-include.js
Created September 2, 2020 17:56
An implementation of Handlebars templating as a ServiceNow server side Script Include
/**!
@license
handlebars v4.0.9
Copyright (C) 2011-2016 by Yehuda Katz
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
@salcosta
salcosta / Export GitHub Project
Created September 22, 2022 15:27
Exports the current GitHub project page to a CSV format
window.open().document.write([
Array.from(document.querySelectorAll('div[class*="table-header"] div.hoverable[role="columnheader"]')).reduce((headers, header) => {
headers.push(header.innerText);
return headers;
}, []),
...Array.from(document.querySelectorAll('div[data-test-id="table-scroll-container"] div.hoverable[role="row"]')).map(row => {
return Array.from(row.querySelectorAll('div[role="gridcell"][tabindex]')).map(rowCells => rowCells.innerText);
})
].join("<br/>"));