Skip to content

Instantly share code, notes, and snippets.

View megasmack's full-sized avatar

Steve Schrab megasmack

View GitHub Profile
@jamigibbs
jamigibbs / getPageRef.js
Created January 8, 2020 16:54
Get Page Ref
import { LightningElement, wire } from 'lwc';
import { CurrentPageReference } from 'lightning/navigation';
export default class PageRefDemo extends LightningElement {
@wire(CurrentPageReference)
currentPageReference;
handleDisplayPageRefObj(){
const pageRefObj = JSON.stringify(this.currentPageReference, null, 4);
@rambabusaravanan
rambabusaravanan / detect-js-framework.js
Last active April 25, 2024 11:31
Detect JS Framework used in a Website
// Paste these lines into website's console (Win/Linux: Ctrl + Shift + I / Mac: Cmd + Alt + I)
if(!!window.React ||
!!document.querySelector('[data-reactroot], [data-reactid]') ||
Array.from(document.querySelectorAll('*')).some(e => e._reactRootContainer !== undefined || Object.keys(e).some(k => k.startsWith('__reactContainer')))
)
console.log('React.js');
if(!!document.querySelector('script[id=__NEXT_DATA__]'))
console.log('Next.js');
@chris-erickson
chris-erickson / get-jira-branchname.js
Last active August 29, 2015 14:25
Something dumb to make getting JIRA branchnames faster.
var selectedIssue = document.querySelectorAll(".ghx-selected")[0];
var key = selectedIssue.dataset.issueKey;
var description = selectedIssue.childNodes[0].childNodes[0].childNodes[2].title;
var text = key + '-' + description;
var MAX_LENGTH = 35;
var slug = text.replace(/\s+/g, '-').replace(/[^\w\-]+/g, '').replace(/\-\-+/g, '-').replace(/^-+/, '').replace(/-+$/, '').substring(0, MAX_LENGTH);
window.prompt("Copy this!", 'git checkout -b \'' + slug + '\'');
@chris-erickson
chris-erickson / millertime
Last active November 7, 2015 21:42
A helper to notify you when you have brews ready to update
#!/bin/bash
# This script runs the homebrew updater, then reports if any of your packages are out of date
# Generally, this should be run automatically using a launchctl task (see end of file for an example)
#
# In addition, you might want to change the notification style to be an "alert" so it hangs around a while.
# This can be done in System Preferences -> Notification Center (look for homebrew-notifier)
#
# Requires:
# - Homebrew
# - terminal-notifier (brew install terminal-notifier)