Skip to content

Instantly share code, notes, and snippets.

View rcherny's full-sized avatar

Rob Cherny rcherny

View GitHub Profile
@rcherny
rcherny / input.scss
Created March 2, 2022 19:11 — forked from GiselaMD/input.scss
Generated by SassMeister.com.
// This is the default html and body font-size for the base rem value.
$rem-base: 16px !default;
$base-font-family: 'din-2014', Arial, sans-serif;
$fallback-font-family: Arial, sans-serif;
// --- Colors ---
$colors: (
primary: (
enterpriseGreen: #169a5a,
@rcherny
rcherny / bookmark.js
Created March 12, 2021 15:49 — forked from clenemt/bookmark.js
AEM bookmark for quick edit/preview switch
// Drops you in preview mode
javascript:(function() {
var d = document, l = d.location, s = l.search;
d.cookie = 'wcmmode=preview; path=/';
if (l.href.includes('editor.html') || !l.href.includes('wcmmode=disabled')) {
s = s.replace(/[\?&]?wcmmode=\w*/g, '');
l.href = l.origin + l.pathname.replace(/\/editor\.html/g, '') + s + (s ? '&' : '?') + 'wcmmode=disabled';
} else {
@rcherny
rcherny / WCMMode
Created March 12, 2021 15:46 — forked from Doff3n/WCMMode
WCMMode bookmarklet toggle for AEM 6.0
javascript:(function() { document.location = (document.location.href.search(/[?&]wcmmode=disabled/) < 0 ? document.location.href + (document.location.href.indexOf('?') < 0 ? '?' : (document.location.href.search(/\?./) < 0 ? '' : '&')) + 'wcmmode=disabled' : document.location.toString().replace(/wcmmode=disabled&?/, '')).replace(/[?&]$/, '');if(window.location.href.indexOf("cf#") > -1){location.reload();}})();
@rcherny
rcherny / Promise_Patterns.md
Created December 17, 2020 01:15 — forked from dannyfritz/Promise_Patterns.md
Promise Patterns for Happier Relationships 💍

Promises

new Promise()

  • new Promise((resolve, reject) => {})
const getDinosaur = (name) => {
  return new Promise((resolve, reject) => {
    resolve({name})
@rcherny
rcherny / debugger pause beforeunload
Last active March 27, 2021 14:34 — forked from carcinocron/debugger pause beforeunload
Chrome: pause before redirect
// Run this in the F12 javascript console in chrome
// if a redirect happens, the page will pause
// this helps because chrome's network tab's
// "preserve log" seems to technically preserve the log
// but you can't actually LOOK at it...
// also the "replay xhr" feature does not work after reload
// even if you "preserve log".
function createPause() {
console.log('debugger breakpoint applied to beforeunload;');
@rcherny
rcherny / prettier-branch.sh
Created April 1, 2019 17:25 — forked from tlrobinson/prettier-branch.sh
Steps for merging an old branch into a newly prettier-ified codebase. Use at your own risk, verify everything was correctly merged.
# Assumes 3 sequential commits:
#
# 1. commit tagged "prettier-before" that added `prettier` depedency and `prettier` script your package.json
# 2. commit that actually ran `prettier` on your entire codebase for the first time
# 3. commit tagged "prettier-after" that fixes any minor issues caused by prettier (e.x. moving eslint-ignore or $FlowFixMe comments around), or just the next commit if there were none
#
# I recommend running these as individual commands, not as a script, in case of merge conflicts
#
# Checkout the non-pretty branch you want to merge
# (or optionally make a new branch with `git checkout -b $YOUR_BRANCH-prettier $YOUR_BRANCH`)
@rcherny
rcherny / gist:15063948c95f535fbc75abf8925527b2
Created September 13, 2017 18:48 — forked from hiddentao/gist:5946053
Generate overridable getters and setters in Javascript
// see blog post: http://www.hiddentao.com/archives/2013/07/08/generate-overridable-getters-and-setters-in-javascript/
Function.prototype.generateProperty = function(name, options) {
// internal member variable name
var privateName = '__' + name;
options = options || {};
options.get = ('undefined' === typeof options.get ? true : options.get );
options.set = ('undefined' === typeof options.set ? true : options.set );
// pre-initialise the internal variable?
@rcherny
rcherny / dnsmasq OS X.md
Last active May 29, 2020 19:27 — forked from ogrrd/dnsmasq OS X.md
Setup dnsmasq on OS X

much, much newer and better ?

Never touch your local /etc/hosts file in OS X again

To setup your computer to work with *.dev domains, e.g. project.dev, awesome.dev and so on, without having to add to your hosts file each time.

Requirements

import sublime
import sublime_plugin
class CursorCommand(sublime_plugin.TextCommand):
saved_cursors_map = {}
def run(self, edit, action="add"):
view = self.view
cursors = view.sel()
view_id = view.id()
@rcherny
rcherny / FileTransfer.py
Created November 21, 2016 02:10 — forked from omz/FileTransfer.py
File Transfer script for Pythonista (iOS)
# File Transfer for Pythonista
# ============================
# This script allows you to transfer Python files from
# and to Pythonista via local Wifi.
# It starts a basic HTTP server that you can access
# as a web page from your browser.
# When you upload a file that already exists, it is
# renamed automatically.
# From Pythonista's settings, you can add this script
# to the actions menu of the editor for quick access.