Skip to content

Instantly share code, notes, and snippets.

echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://npmjs.org/install.sh | sh
@mundry
mundry / highlight.css
Last active July 29, 2022 13:57
Live text highlighting.
#hits-count {
font-size: .65em;
color: #888888;
}
.match {
color: #FF6347;
}
@mundry
mundry / index.html
Last active December 30, 2015 13:19
Sticky sidebar following the user as they scroll.
<!DOCTYPE html>
<html class="no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Sticky Sidebar</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Place favicon.ico and apple-touch-icon(s) in the root directory -->
<style>
@mundry
mundry / index.html
Last active December 30, 2015 14:59
Dropdown menu. Does not work (properly) with less than IE9.
<!DOCTYPE html>
<html class="no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Dropdown</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Place favicon.ico and apple-touch-icon(s) in the root directory -->
<link rel="stylesheet" href="style.css" type="text/css">
@mundry
mundry / css-filter.js
Created December 7, 2013 21:31
Filtering page content with an input field and CSS3.
(function() {
var searchStyle = document.getElementById('search-style');
var searchfield = document.getElementById('filter-field')
var injectCssRule = function(query) {
return query === "" ? "" : ('h1:not([data-filter-keywords*="' + query.replace(/\\/g, "") + '"]) { display: none; }');
}
searchfield.addEventListener("keyup", function() {
searchStyle.innerHTML = injectCssRule(searchfield.value.trim().toLowerCase());
@mundry
mundry / sublime_exclude_patterns.py
Created December 12, 2013 16:52
Script to accumulate exclusion patterns for files and folders used in Sublime Text project files.
#!/usr/bin/env python
from collections import OrderedDict
from json import loads
SUBLIME_CONFIG_FILES = ['...']
file_exclude_patterns = []
folder_exclude_patterns = []
def mapfn():
@mundry
mundry / index.html
Last active December 31, 2015 04:39
Highlighting of the current page in the navigation with JavaScript for very simple static pages.
<!DOCTYPE html>
<html class="no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style> .current { color: #FFAA44; } </style>
</head>
@mundry
mundry / index.html
Last active December 31, 2015 08:29
Pagination
<!DOCTYPE html>
<html class="no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Pagination</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="style.css" type="text/css">
<style>
@mundry
mundry / localstorage-shim.js
Created December 14, 2013 18:38
Exact imitation of the localStorage object, but uses cookies to provide localStorage in browsers that don't support it.
// https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Storage#Compatibility
// Note: The maximum size of data that can be saved is severely
// restricted by the use of cookies. With this algorithm, use the
// functions localStorage.setItem() and localStorage.removeItem() to
// add, change, or remove a key. The use of methods
// localStorage.yourKey = yourValue; and delete localStorage.yourKey; to
// set or delete a key *is not a secure way with this code*. You can
// also change its name and use it only to manage a document's cookies
// regardless of the localStorage object.
@mundry
mundry / localstorage-shim.js
Created December 14, 2013 19:00
Less exact but IE6 compatible imitation of the localStorage object to provide localStorage in browsers that don't support it by using cookies.
// https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Storage#Compatibility
// Note: The maximum size of data that can be saved is severely
// restricted by the use of cookies. With this algorithm, use the
// functions localStorage.getItem(), localStorage.setItem(), and
// localStorage.removeItem() to get, add, change, or remove a key. The
// use of method localStorage.yourKey in order to get, set, or delete a
// key *is not permitted with this code*. You can also change its name
// and use it only to manage a document's cookies regardless of the
// localStorage object.