Skip to content

Instantly share code, notes, and snippets.

View manvillej's full-sized avatar

Jeff Manville manvillej

View GitHub Profile
// Scripted Resolver: getTestInformation
(function process(/*ResolverEnvironment*/ env) {
var test = new GlideRecord("sys_atf_test");
var sys_id = env.getArguments().id;
if(test.get(sys_id)){
return ATFGraphQLAPI.atfTestToJson(test);
}
return;
})(env);
@manvillej
manvillej / atfTest.gql
Last active January 31, 2021 02:32
atf test graphql example 1
schema {
query: Query
}
type Query {
atfTest(id: String!): atfTest
}
type atfTest {
active: Boolean
import csv
import pandas as pd
import random
import re
file_path = 'C:/Users/Jenny/Desktop/BU COM/Fall 2019/EM 855 Comp Assisted Text Analysis/Research Project/Data/Cursing_Lexicon_05.11.17.txt'
file_export = 'C:/Users/Jenny/Desktop/BU COM/Fall 2019/EM 855 Comp Assisted Text Analysis/Research Project/Data/Cursing_Lexicon_in_one_line.txt'
uncivil_dictionary = open(file_path, 'r')
dictionary = open(file_export, 'w+')
@manvillej
manvillej / publisher.py
Created October 15, 2019 14:05
CSCI-E90 HW6: publisher.py
"""
CSCI-E90 HW6: publisher.py
"""
# std library
# custom packages
@manvillej
manvillej / uipage.xml
Created July 25, 2019 16:31
example ui page
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<g:evaluate var="jvar_models" object="true">
var gr = new GlideRecord("cmdb_hardware_product_model");
gr.addEncodedQuery("cmdb_model_category=b9eb7414c3031000b959fd251eba8fe5"); // category is ipphone
gr.query();
gr;
</g:evaluate>
<j:while test="${jvar_models.next()}">
<j:if test="${jvar_models.getValue('description')!=''}">
@manvillej
manvillej / validate_date_times.js
Created July 23, 2019 15:16
modified Set Start and End Dates
(function executeRule(current, previous /*null when async*/) {
if (current.end_date < current.start_date) {
gs.addErrorMessage('End date must be later than start date!');
current.setAbortAction(true);
}
var today = new GlideDateTime((new GlideDate().getValue()) + " 23:59:59");
if(today.after(new GlideDateTime(current.start_date))) {
gs.addErrorMessage('Start date must be after today');
current.setAbortAction(true);
}
@manvillej
manvillej / uipage.xhtml
Created July 22, 2019 17:28
bad ui page
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<g:evaluate var="jvar_models" object="true">
var gr = new GlideRecord("cmdb_hardware_product_model");
gr.addEncodedQuery("cmdb_model_category=b9eb7414c3031000b959fd251eba8fe5"); // category is iphone
gr.query();
gr;
</g:evaluate>
<j:while test="${jvar_models.next()}">
<j:if test="${jvar_models.getValue('description')!=''}">
>>> import numpy as np
>>> matrixA = np.matrix([
... [0, 0, 0, 0, 1, 0, 1, 0, 0, 0],
... [0, 0, 0, 0, 0, 0, 1, 0, 1, 0],
... [0, 0, 0, 0, 0, 0, 0, 1, 0, 1],
... [0, 0, 0, 0, 1, 0, 0, 0, 1, 0],
... [1, 0, 0, 1, 0, 0, 0, 0, 0, 0],
... [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
... [1, 1, 0, 0, 0, 0, 0, 1, 0, 0],
def getPossibilities(startingPosition, turns):
"""
calculates the total number of uniques paths from the starting position in N turns for the transition matrix
"""
# edge case: if turns is 0, total number of unique paths is 1
if turns == 0:
return 1
# edge case: if starting position is 5 and turns is not 0, total number of unique paths is always 0