Skip to content

Instantly share code, notes, and snippets.

View hs0ucy's full-sized avatar
💭
"Hyperlinks subvert (hack) hierarchy"

Hugo Soucy hs0ucy

💭
"Hyperlinks subvert (hack) hierarchy"
View GitHub Profile
@ap
ap / html2markdown.xslt
Last active August 26, 2020 08:35
HTML to Markdown in (E)XSLT
<xsl:stylesheet version="1.0"
xmlns:h="http://www.w3.org/1999/xhtml"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fn="http://exslt.org/functions"
xmlns:str="http://exslt.org/strings"
xmlns:my="urn:my:"
extension-element-prefixes="fn str my"
>
<xsl:output method="text" encoding="utf-8" />
@ryansully
ryansully / optimize.sh
Created February 1, 2012 23:56 — forked from realdeprez/optimize.sh
image optimization script (pngcrush & jpegtran)
#!/bin/sh
# script for optimizing images in a directory (recursive)
# pngcrush & jpegtran settings from:
# http://developer.yahoo.com/performance/rules.html#opt_images
# pngcrush
for png in `find $1 -iname "*.png"`; do
echo "crushing $png ..."
pngcrush -rem alla -reduce -brute "$png" temp.png
@wdkrnls
wdkrnls / org-syntax-cheatsheet.org
Created March 7, 2012 03:54
Org-mode Syntax Cheat sheet

Markup Cheat sheet for Org-mode

Heading 1

Heading 2: Set a deadline and a schedule

[66%] Heading 3: a list with checkboxes

  1. [X] task 1
  2. [X] task 2
  3. [ ] task 3
anonymous
anonymous / button-arrow-gradient.css
Created December 12, 2012 13:30
CSS Button with arrow & gradient (Square rotation technique).
.button-next-arrow {
background-image: linear-gradient(bottom, rgb(52,70,115) 20%, rgb(103,125,180) 80%);
background-image: -o-linear-gradient(bottom, rgb(52,70,115) 20%, rgb(103,125,180) 80%);
background-image: -moz-linear-gradient(bottom, rgb(52,70,115) 20%, rgb(103,125,180) 80%);
background-image: -webkit-linear-gradient(bottom, rgb(52,70,115) 20%, rgb(103,125,180) 80%);
background-image: -ms-linear-gradient(bottom, rgb(52,70,115) 20%, rgb(103,125,180) 80%);
background-image: -webkit-gradient(
linear,
left bottom,
@pkuczynski
pkuczynski / parse_yaml.sh
Last active May 25, 2024 15:21
Read YAML file from Bash script
#!/bin/sh
parse_yaml() {
local prefix=$2
local s='[[:space:]]*' w='[a-zA-Z0-9_]*' fs=$(echo @|tr @ '\034')
sed -ne "s|^\($s\)\($w\)$s:$s\"\(.*\)\"$s\$|\1$fs\2$fs\3|p" \
-e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $1 |
awk -F$fs '{
indent = length($1)/2;
vname[indent] = $2;
for (i in vname) {if (i > indent) {delete vname[i]}}
# Hello, and welcome to makefile basics.
#
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
#
# Once you're done here, go to
# http://www.gnu.org/software/make/manual/make.html
# to learn SOOOO much more.
@wilfm
wilfm / grephexcolourcode
Created September 14, 2015 17:54
Grep Hex Colour Codes from file
#!/bin/bash
#get hex codes in form #fff and #ffffff
#checks to see if not - especially needed on #fff matches
#FIXME: - currently prints trailing character
if [[ ! -a $1 ]]; then
echo File not found
exit 1
fi
sed ':a;N;$!ba;s/\n/ /g' "$1" | grep -o '\#[0-9a-fA-F]\{3\}[^0-9a-fA-F]' | sed 's/[^0-9a-fA-F#]//g' | sort -u
@paulirish
paulirish / what-forces-layout.md
Last active May 26, 2024 09:59
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@Eloi
Eloi / browser_automation.sh
Last active December 1, 2021 18:24
Simple shellscript to easily reload browser/terminal/other windows, without losing focus on the current window. Bind it to some useful key shortcut (p.e. win+r) to speed up web development process ;)
#!/bin/sh
if [ -n "$1" ]; then
if [ "$1" = "grab_id" ]; then
xdotool selectwindow >/tmp/autoreload_window_id
elif [ "$1" = "reload" ]; then
WINDOWID=`cat /tmp/autoreload_window_id`
/*
* An URI datatype. Based upon examples in RFC3986.
*
* TODO %-escaping
* TODO split apart authority
* TODO split apart query_string (on demand, anyway)
*
* @(#) $Id$
*/