Skip to content

Instantly share code, notes, and snippets.

View wuduhren's full-sized avatar
🎯
Focusing

wuduhren wuduhren

🎯
Focusing
View GitHub Profile
@mumrah
mumrah / AddToMap.java
Created June 11, 2013 02:39
A Pig UDF that allows you to modify a map by adding additional key/value pairs
import java.io.IOException;
import java.util.Map;
import org.apache.pig.EvalFunc;
import org.apache.pig.data.DataType;
import org.apache.pig.data.Tuple;
/**
* Simple UDF to allow modifying an existing map[] datum
*
* Usage:
@idleberg
idleberg / sublime-text-macos-context-menu.md
Last active April 28, 2025 22:55 — forked from vincentmac/sublime-text-osx-context-menu.md
“Open in Sublime Text” in macOS context-menu

This list has been updated for Big Sur (and later). Since I don't use these versions, this guide might still need further improvements. For older macOS versions, please see this older revision.

Open in Sublime Text

  • Open Automator
  • Quick Action
  • Set “Service receives selected” to files or folders in any application
  • Add a Run Shell Script action
  • Set the script action to /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl -n "$@"
  • Set “Pass input” to as arguments
@stephenorem
stephenorem / searchDepth.js
Created February 5, 2018 18:57
searchDepth - find the depth of nested html elements; for example, ul/ol - uses jQuery
function searchDepth() {
var maxDepth = 0,
d,
parents,
myselector = 'ul, ol';
$(myselector).each( function(i) {
parents = $(this).parents(myselector);
d = parents ? parents.length + 1 : 1;
maxDepth = d > maxDepth ? d : maxDepth;