Skip to content

Instantly share code, notes, and snippets.

@johncaruso
johncaruso / global-gitignore.md
Created October 13, 2018 16:56 — forked from subfuzion/global-gitignore.md
Global gitignore

There are certain files created by particular editors, IDEs, operating systems, etc., that do not belong in a repository. But adding system-specific files to the repo's .gitignore is considered a poor practice. This file should only exclude files and directories that are a part of the package that should not be versioned (such as the node_modules directory) as well as files that are generated (and regenerated) as artifacts of a build process.

All other files should be in your own global gitignore file. Create a file called .gitignore in your home directory and add anything you want to ignore. You then need to tell git where your global gitignore file is.

Mac

git config --global core.excludesfile ~/.gitignore

Windows

git config --global core.excludesfile %USERPROFILE%\.gitignore
@johncaruso
johncaruso / case-convert.js
Created June 18, 2018 23:21 — forked from rebolyte/case-convert.js
Change a string from camelCase to kebab-case or snake_case and vice versa
'use strict';
let DASH_LOWERCASE_REGEX = /-([a-z])/g;
let UNDERSCORE_LOWERCASE_REGEX = /_([a-z])/g;
let UPPERCASE_REGEX = /([A-Z])/g;
// func argument to .replace receives:
// 1) the matched substring
// 2) nth parenthesized substr match (i.e. if the pattern has any `()` group matches,
// those will be passed as the next args)
@johncaruso
johncaruso / token.xhtml
Created May 8, 2018 12:40 — forked from stegel/token.xhtml
How to get session token on a ui page with direct=true
<!--- In a ui page -->
<!-- this will get the token on the server side and set it to a client-side javascript variable.
<g:evaluate object="true">
var g_ck = gs.getSessionToken();
</g:evaluate>
<script>
window.g_ck = "$[g_ck]";
</script>
<!-- In your AngularJS config, you can set the token as a default $httpProvider header -->
@johncaruso
johncaruso / AttachmentImportProcessor.js
Created February 17, 2018 20:24 — forked from paulsena/AttachmentImportProcessor.js
Service Now Email Attachment Processor.Allows ServiceNow to accept attachments via email and process them through a data source/import set/ transform map.
/*
* Script include to process multiple attachments in an email through OOB Data Source process.
* Attaches to existing data source, dynamically creates a schedule import entry and runs.
* Processes attachments synchronously to prevent issues with multiple attachments
*
* Source: Fruition Partners
* Author: [email protected]
* Author: [email protected]
*/