Skip to content

Instantly share code, notes, and snippets.

View camjocotem's full-sized avatar

Jonny Campbell camjocotem

  • West Yorkshire
  • 03:25 (UTC +01:00)
View GitHub Profile
@camjocotem
camjocotem / emotions.json
Created September 29, 2025 10:25
Emotion Wheel (WIP)
[
{
"emotion": "Anger",
"children": [
{
"emotion": "Hurt",
"children": [
{
"emotion": "Embarrassed"
},
@camjocotem
camjocotem / arrayDictionaryProto.js
Last active October 25, 2024 13:49
Array Dictionary
Array.prototype.toDictionary = function (keySelector, valueSelector = null) {
const dict = this.reduce((dict, item) => {
const key = keySelector(item);
dict[key] = valueSelector ? valueSelector(item) : item;
return dict;
}, {});
// Return an object that is both iterable and accessible by key
return {
...dict,
@camjocotem
camjocotem / ha.js
Created March 5, 2024 14:29
Minor Heart Attack
function _0x4674(){var _0x41f5d0=['855892UhQbNz','fixed','bottom','src','width','-45rem','transition-duration','t-shite','https://s3.eu-west-2.amazonaws.com/t-shite.com/TOASTY.wav','11781374AANdIk','587795AnNezx','214516mFESTt','3UIonJE','587412qHkKjh','source','style','getElementsByTagName','position','setAttribute','transition-property','3eQbNrZ','10vw','createElement','https://s3.eu-west-2.amazonaws.com/t-shite.com/T_NoBackground.png','appendChild','17253DMhsww','height','0.2s','240kTeqyE','body','45rem','img','48YbNeVC','35rem','1710738BcqlcJ'];_0x4674=function(){return _0x41f5d0;};return _0x4674();}var _0x25b0ee=_0x2a9d;(function(_0xcdd3db,_0x47b60d){var _0x144ebe=_0x2a9d,_0x260f5a=_0xcdd3db();while(!![]){try{var _0x3cb1c7=-parseInt(_0x144ebe(0x12f))/0x1*(-parseInt(_0x144ebe(0x12e))/0x2)+parseInt(_0x144ebe(0x137))/0x3*(parseInt(_0x144ebe(0x146))/0x4)+parseInt(_0x144ebe(0x12d))/0x5+parseInt(_0x144ebe(0x145))/0x6+parseInt(_0x144ebe(0x130))/0x7*(parseInt(_0x144ebe(0x143))/0x8)+parseInt(_0x144ebe(0x13c))/0x9
@camjocotem
camjocotem / dictionary.js
Created October 31, 2023 11:45
Javascript Object dictionary
Object.dictionary = function(obj){
return Object.entries(obj).map(entry => {
return {
key: entry[0],
value: entry[1]
}
})
}
@camjocotem
camjocotem / .gitconfig
Last active September 18, 2023 11:13
.gitconfig (Log alias) git lg
[alias]
lg = lg1
lg1 = lg1-specific --all
lg2 = lg2-specific --all
lg3 = lg3-specific --all
lg1-specific = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(auto)%d%C(reset)'
lg2-specific = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(auto)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)'
lg3-specific = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset) %C(bold cyan)(committed: %cD)%C(reset) %C(auto)%d%C(reset)%n'' %C(white)%s%C(reset)%n'' %C(dim white)- %an <%ae> %C(reset) %C(dim white)(committer: %cn <%ce>)%C(reset)'
@camjocotem
camjocotem / RFlatMap.js
Created June 27, 2023 09:27
Recursive FlatMap
const flatten = (routes) => {
return routes.reduce((acc, r) => {
if(r.childRoutes && r.childRoutes.length) {
acc = acc.concat(flatten(r.childRoutes));
} else {
acc.push(r);
}
return acc;
}, [])
@camjocotem
camjocotem / RemoveRedditPromos.js
Last active June 17, 2023 11:59
Remove Reddit Promotional Tweets (To use with Javascript extension such as Custom Javascript For Websites 2)
function findTopPostElement(el){
if(isTopPostElement(el)){
return el;
}
else{
return findTopPostElement(el.parentElement);
}
}
function isTopPostElement(el){
[].forEach.call(window.$$("*"),function(a){a.style.outline="1px solid #"+(~~(Math.random()*(1<<24))).toString(16)})
@camjocotem
camjocotem / debug css
Created October 1, 2021 15:06
debug css
javascript:[].forEach.call(window.$$("*"),function(a){a.style.outline="1px solid #"+(~~(Math.random()*(1<<24))).toString(16)})
@camjocotem
camjocotem / GetTfsItems.js
Last active November 18, 2020 17:05
Get all tagged TFS work items since last live release
//This script makes some assumptions
//1. You tag the work items in your commits e.g. #1234 - Fixed bug
//2. That all 'live' environments will have the same name
//https://docs.microsoft.com/en-us/rest/api/azure/devops/?view=azure-devops-rest-6.1#api-and-tfs-version-mapping
const apiVersion = "4.1-preview"
const serverUrl = "http://serverurlhere:8080" //
const projectList = ["Some_Frontend_Project","Some_Backend_Project"];
const liveEnvironmentName = "Live"