Skip to content

Instantly share code, notes, and snippets.

@UInIQ
UInIQ / compact_expand_css_command.py
Created June 22, 2017 14:23 — forked from vitaLee/compact_expand_css_command.py
SublimeText command for compacting/expanding CSS rules
import sublime
import sublime_plugin
import re
class CompactExpandCssCommand(sublime_plugin.TextCommand):
def run(self, edit, action='compact'):
rule_starts = self.view.find_all('\{')
rule_ends = self.view.find_all('\}')
@UInIQ
UInIQ / git_completion.sh
Created January 18, 2018 08:43
Copy of Shawn Pearce's amazing Git completion BASH SHELL routines for remote injection at VMU
# bash/zsh completion support for core Git.
#
# Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org>
# Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/).
# Distributed under the GNU General Public License, version 2.0.
#
# The contained completion routines provide support for completing:
#
# *) local and remote branch names
# *) local and remote tag names
@UInIQ
UInIQ / .git-prompt.sh
Created January 18, 2018 17:08
GitHub Shell PS1 prompt, custom for VMU
# bash/zsh git prompt support
#
# This script allows you to see repository status in your prompt.
#
# To enable:
#
# 1) Copy this file to somewhere (e.g. ~/.git-prompt.sh).
# 2) Add the following line to your .bashrc/.zshrc:
# source ~/.git-prompt.sh
# 3a) Change your PS1 to call __git_ps1 as
#!/bin/sh
# Run a command; post it and its standard input, output, and error to Slack.
#
# This program expects SLACK_WEBHOOK_URL in its environment. You can get one
# by creating a new Incoming Webhook at <https://my.slack.com/services/new>.
#
#/ Usage: slack [--attach] [--channel=<channel>] [--stdin] ...
#/ --attach post to Slack with an attachment (defaults to fixed-width text)
#/ --channel=<channel> post to this Slack channel (defaults to the integration's default channel)
@UInIQ
UInIQ / BASH CLI flag template
Last active March 14, 2018 22:01
BASH/SHELL CLI -input=flags template
#!/bin/bash
# Usage: script.sh [-a|--alpha] [-b=val|--bravo=val]
# Global Declarations
BRAVO=""
function usage(){
echo "That's not how it works, dummy!";
}
@UInIQ
UInIQ / background.js
Created February 20, 2018 19:00
Bare minimum Chrome extension to inject a JS file into the given page when you click on the browser action icon. The script then inserts a new div into the DOM.
// this is the background code...
// listen for our browerAction to be clicked
chrome.browserAction.onClicked.addListener(function (tab) {
// for the current tab, inject the "inject.js" file & execute it
chrome.tabs.executeScript(tab.ib, {
file: 'inject.js'
});
});
@UInIQ
UInIQ / <[JS] element.AddEventListener
Created March 2, 2018 08:50
Check event bindings on every object (appended at the prototyppe level)
[Element].forEach(function(self){
self.prototype.activeListeners = {};
self.prototype._addEventListener = self.prototype.addEventListener;
self.prototype.addEventListener = function(type, handle, useCapture) {
useCapture = useCapture || false;
node._addEventListener(type, handle, useCapture);
var node = this;
@UInIQ
UInIQ / AEM.getParentProps
Created March 8, 2018 18:34
HTL Getting Property value from parent component
//https://forums.adobe.com/message/9552896#9552896
"use strict";
use(function () {
var parent = resource.getParent();
var props = parent.adaptTo(Packages.org.apache.sling.api.resource.ValueMap);
return props.get("jcr:createdBy","");
});
@UInIQ
UInIQ / gitignore.sh
Created March 10, 2018 22:05
Add indeterminate number of files to .gitignore at specific hierarchy, then condense and purge duplicates.
#!/bin/bash
# Usage:
# gig path_to_file path_to_other_file
function gig(){
# Iterate the function arguments
for item in "$@"; do
# Append each to .gitignore at current folder level
echo "$item" >> .gitignore;
done
@UInIQ
UInIQ / gittyup.sh
Last active March 14, 2018 21:51
Makes a trivial alteration to the final line of a file to ensure github flags it as changed
#!/bin/bash
# Usage:
# gig path_to_file path_to_other_file
function gittyup(){
# Iterate the function arguments
for item in "$@"; do
# Append a block comment to the end of the specified file.
echo " /**/ " >> $item;
done