Skip to content

Instantly share code, notes, and snippets.

View egoes's full-sized avatar

Enrique Pardo egoes

View GitHub Profile
@trych
trych / ES_IndentFirstLineToPrevious.js
Created November 7, 2015 19:15
ExtendScript: Fit firstLineIndent to previous paragraph
// fits the firstLineIndent of a paragraph to the end of the previous paragraph
// as asked here: https://graphicdesign.stackexchange.com/questions/62916/
#target InDesign
var defaultIndent = 5;
//Checks if a text frame with 2 or more paragraphs was selected.
if (app.selection.length < 1 || !(app.selection[0].parentStory.paragraphs.length > 1)) {
alert("Error\nSelect a text frame with at least 2 paragraphs and try again.");
@dydx
dydx / accel_y_axis_led_swap.pde
Created December 10, 2011 22:54
illuminate left or right led with accelerometer tilt
/**
Two LEDs triggered by tilting of accelerometer
along Y axis.
Arduino Diecimila and Memsic 2125
*/
int ledPins[] = {6,7};
int yPin = 10;
int yRaw;
@gruber
gruber / Liberal Regex Pattern for All URLs
Last active March 20, 2024 20:28
Liberal, Accurate Regex Pattern for Matching All URLs
The regex patterns in this gist are intended to match any URLs,
including "mailto:foo@example.com", "x-whatever://foo", etc. For a
pattern that attempts only to match web URLs (http, https), see:
https://gist.github.com/gruber/8891611
# Single-line version of pattern:
(?i)\b((?:[a-z][\w-]+:(?:/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))