Skip to content

Instantly share code, notes, and snippets.

@jvzr
jvzr / collapse-root-comment.js
Last active February 17, 2020 10:23
Module for Refined Hacker News addon that adds a button to collapse the root comment of any child comment
import {getAllComments} from '../libs/dom-utils';
import {paths} from '../libs/paths';
function getCommentIndentation(element) {
const parent = element.parentElement;
const indentation = parent.querySelector('.ind img').width / 40;
return indentation;
}
async function init(metadata) {
@jvzr
jvzr / hn.css
Last active February 17, 2020 14:18
Stylesheet to customize HN a bit (to be used with Refined Hacker News addon)
body, #hnmain {
background-color: #eee;
}
#hnmain {
position: relative;
border: 0px solid #dda;
max-width: 850px !important;
background-color: #fff;
}
@jvzr
jvzr / gist:7473113
Last active December 28, 2015 08:39
#!/usr/local/bin/ruby
# -*- encoding: utf-8 -*-
require "rubygems"
require "mail"
require "fileutils"
require "daemons"
# I know I probably shouldn't use constants like that…
DEBUG = true
@jvzr
jvzr / media_queries.scss
Created July 10, 2013 16:46
The media queries mixin I use in SCSS. Quite handy.
$desktop: "only screen and (min-width: 1024px)";
$retina: "only screen and (-webkit-min-device-pixel-ratio: 2)";
$non_retina: "only screen and (-webkit-max-device-pixel-ratio: 1)";
$ipad: "only screen and (min-device-width: 768px) and (max-device-width: 1024px)";
$ipad_landscape: "only screen and (min-device-width: 768px) and (max-device-width: 1024px) and (orientation: landscape)";
$ipad_portrait: "only screen and (min-device-width: 768px) and (max-device-width: 1024px) and (orientation: portrait)";
$ipad_retina: "only screen and (min-device-width: 768px) and (max-device-width: 1024px) and (-webkit-min-device-pixel-ratio: 2)";
@jvzr
jvzr / gist:1142600
Created August 12, 2011 18:04
Keyboard Maestro action script for Safari
tell application id "com.apple.finder"
tell window of desktop
set {_, _, lngwidth, lngHeight} to bounds
set lngHeight to lngHeight - 22
end tell
end tell
tell application "System Events" to tell process "Safari"
get value of attribute "AXFullScreen" of window 1
if result = false then
@jvzr
jvzr / gist:1063562
Created July 4, 2011 16:18
Resize Safari
tell application id "com.apple.finder"
tell window of desktop
set {_, _, lngwidth, lngHeight} to bounds
set lngHeight to lngHeight - 22
end tell
end tell
tell application "System Events" to tell process "Safari"
tell front window
set position to {22, 22 * 2}