Skip to content

Instantly share code, notes, and snippets.

@ttscoff
ttscoff / sizes.rb
Last active July 12, 2021 03:33
sizes: Calculate and sort all filesizes for current folder
#!/usr/bin/env ruby
# Sizes - Calculate and sort all filesizes for current folder Includes
# directory sizes, colorized output Brett Terpstra 2019 WTF License
VERSION = "1.0.1"
require 'shellwords'
# Just including term-ansicolor by @flori and avoiding all the
# rigamarole of requiring multiple files when it's not a gem... - Brett
#
@crmne
crmne / Google Translate.scpt
Last active May 15, 2018 18:06
UPDATE: I made a LaunchBar 6 action that you can find here: http://static.paolino.me/GoogleTranslate.lbaction.zip. Make sure to enable Accessibility for LaunchBar, and "Allow Javascript from Apple Events" in Safari's Develop menu. -- Translates text using Google Translate in Safari. It gracefully handles large text, which is impossible with just…
on safari_is_ready(docNum, interval)
repeat
tell application "Safari"
try
do JavaScript "document.readyState" in document docNum
set readyState to result
set finishedLoading to (source of document docNum contains "</html>")
if finishedLoading and readyState is "Complete" then exit repeat
end try
end tell
@bburton
bburton / Rules
Created January 15, 2014 16:08
Better default Rules for nanoc static site compiler (http://nanoc.ws version 3.x) that for the simple cases require little to no configuration. Files that are considered to be pages (based on a list of extensions), are appropriately filtered and routed for some common file types such as Haml, Markdown and Textile. All other text files and binary…
#!/usr/bin/env ruby
# This Rules file is an attempt at a near zero configuration for the common
# use cases when creating a simple site with nanoc. It's meant to have
# better defaults so new users don't have to configure it much if at all.
# For the most part, it copies all files from the content folder to the
# output folder with the same name. It has the following features:
#
# * Certain predefined page extensions such as html, haml, md, markdown and
# textile are routed to "clean" URI's (see below regarding Item identifiers).
@kconragan
kconragan / keyrepeat.shell
Last active December 4, 2023 03:40
Enable key repeat in Apple Lion for Sublime Text in Vim mode
# Mac OS X Lion introduced a new, iOS-like context menu when you press and hold a key
# that enables you to choose a character from a menu of options. If you are on Lion
# try it by pressing and holding down 'e' in any app that uses the default NSTextField
# for input.
#
# It's a nice feature and continues the blending of Mac OS X and iOS features. However,
# it's a nightmare to deal with in Sublime Text if you're running Vintage (Vim) mode,
# as it means you cannot press and hold h/j/k/l to move through your file. You have
# to repeatedly press the keys to navigate.
@seth
seth / yui_compressor.rb
Created January 11, 2011 04:23
A Nanoc filter for minifying CSS and Javascript using the YUI Compressor
YUI_JAR = File.dirname(__FILE__) + "/../tools/yuicompressor-2.4.2.jar"
class YuiCompressor < Nanoc3::Filter
identifier :yui_compress
type :text => :binary
def run(content, params={})
type = type_from_extension
cmd = "java -jar #{YUI_JAR} --type #{type} -o #{output_filename}"
IO.popen(cmd, 'w') { |f| f.write(content) }
raise "yuicompressor exited with #{$?} for '#{cmd}'" unless $? == 0