Skip to content

Instantly share code, notes, and snippets.

@BrettBukowski
BrettBukowski / performance.js
Created September 5, 2014 20:42
Using the navigation timing API to test the performance of a page
(function () {
var t = window.performance.timing;
var timings = [];
timings.push({
label: "Time Until Page Loaded",
time: t.loadEventEnd - t.navigationStart + "ms"
});
timings.push({
{ // General
// > defaults write -g NSTextKillRingSize -string 6
// replace yank: command with yankAndSelect for use with the kill ring
"^y" = (yankAndSelect:);
// uppercase word
"^U" = (uppercaseWord:, moveWordForward:, moveWordBackward:);
// lowercase word
"^~u" = (lowercaseWord:, moveWordForward:, moveWordBackward:);
// titlecase word
"^T" = (capitalizeWord:, moveWordForward:, moveWordBackward:);

Useful Sublime Text Plugins

  • Themr - List installed themes and choose among them
  • Color Highlighter - Highlights rgb and hex codes in the color that they represent
  • ReadmePlease - Pull up the readme for any installed package
  • DockBlockr - Makes writing JavaDoc-style comments a breeze
  • Sublimerge - Provides a ton of useful git diffing / merging functionality
  • GitGitter - Shows what lines are changed from HEAD
  • MarkdownEditing - Turns Sublime into a solid markdown editor
  • SidebarEnhancements - Makes the sidebar useful
@BrettBukowski
BrettBukowski / gist:673ac8e2190a85daa2de
Created July 27, 2014 23:17
Python memoize decorator
import cPickle as pickle
def memoize(func):
results = {}
def wrapper(*args):
key = pickle.dumps(args)
if key not in results:
results[key] = func(*args)
@BrettBukowski
BrettBukowski / teamname.slack.com.js
Created July 16, 2014 17:48
dotjs Slack customization: add avatars to siderail
// - Adds avatars to Slack's members siderail.
// - Hides inactive members.
// Maintain a cache of avatars when moving
// between channels.
var avatars = {};
setInterval(function () {
$('#direct_messages_header').text('people');
$('#im_list_more').hide();
@BrettBukowski
BrettBukowski / gist:563dd0a6f870c9a49a44
Created July 8, 2014 23:13
Clean up OS X's Open With... menu
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user
killall Finder
@BrettBukowski
BrettBukowski / gist:3bed4b58276e5596e74f
Created July 2, 2014 15:11
Perfect vertical+horizontal centering (in SCSS + Bourbon)
// Perfect vertical+horizontal centering.
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
@include prefixer(box-align, center, webkit moz ms spec);
-ms-flex-align: center;
@include prefixer(align-items, center, webkit spec);
@BrettBukowski
BrettBukowski / private.xml
Created June 18, 2014 22:48
KeyboardRemap4MacBook - secret sauce to remap F19 (remapped from caps lock → F19 in Seil) to a hyper key
<?xml version="1.0"?>
<root>
<item>
<name>F19 to F19</name>
<appendix>(F19 to Hyper (ctrl+shift+cmd+opt) + F19 Only, send escape)</appendix>
<identifier>private.f192f19_escape</identifier>
<autogen>
--KeyOverlaidModifier--
KeyCode::F19,
KeyCode::COMMAND_L,
@BrettBukowski
BrettBukowski / gist:10652485
Created April 14, 2014 14:20
Post thru a proxy (ruby)
require 'net/http'
require 'uri'
uri = URI('<post dest>')
Net::HTTP::Proxy('<proxy uri>', 80).start(uri.host, use_ssl: true, verify_mode: OpenSSL::SSL::VERIFY_NONE) do |h|
req = Net::HTTP::Post.new(uri.request_uri)
req.form_data = {
# form data
}
@BrettBukowski
BrettBukowski / exit status.sh
Created March 14, 2014 14:32
Checking exit status of multiple subsequent commands
EXIT_STATUS=0
command1 || EXIT_STATUS=$?
command2 || EXIT_STATUS=$?
command3 || EXIT_STATUS=$?
exit $EXIT_STATUS