Skip to content

Instantly share code, notes, and snippets.

@brianblakely
brianblakely / objectObserveDebugging.js
Last active August 29, 2015 14:07
Object.observe for JavaScript Debugging
// By observing changes to an object with Object.observe,
// and turning on Async Call Stacks in Chrome Dev Tools,
// you can find the source of those changes.
var myObject = {
foo: 'bar'
};
Object.observe(myObject, function(changes) {
// This asynchronous callback runs when myObject is changed
@brianblakely
brianblakely / vertical-alignment.html
Last active September 25, 2015 12:37
Vertical Alignment That Works in IE
<!-- IE6+ -->
<!--
NOTES:
1. For this to work in IE6 or 7, your elements must have a "natural" display value of inline. <span>, <img>, <a> — these are a few elements that qualify.
2. These two elements must be the only immediate children of their parent.
3. valign-content cannot be 100% the width of the container. But it can be 99% width! Play with it.
@brianblakely
brianblakely / gist:1473024
Created December 13, 2011 17:26
Feeding DOM Elements Directly to jQuery
// Element By ID
var $foo = $(document.getElementById('foo'));
// Multiple Elements By ID
var $$foobar = $([
document.getElementById('foo'),
document.getElementById('bar')
]);
// Node List
@brianblakely
brianblakely / dabblet.css
Created March 14, 2012 17:07
Improved Windows 8 Logo
/* Improved Windows 8 Logo */
* {
font-family: "Myriad Pro";
font-size: 96px;
}
body {
padding: 50px;
color: #646464;
}
@brianblakely
brianblakely / gist:2220593
Created March 27, 2012 21:40
Very Semantic Table
<table>
<caption>2009 Employee Sales by Department</caption>
<thead>
<tr>
<td></td>
<th scope="col">food</th>
<th scope="col">auto</th>
<th scope="col">household</th>
<th scope="col">furniture</th>
<th scope="col">kitchen</th>
@brianblakely
brianblakely / 1_brocbab_pre-promise.js
Last active March 11, 2019 16:26
Broccoli Babel Plugin with and without Promises
// Unfinished - before throwing up hands and moving on to refactor
Babel.prototype.write = function(readTree, destDir) {
var self = this;
return readTree(self.inputTree).then(function(srcDir) {
var promise = new rsvp.Promise(function(resolve, reject) {
recreaddir(srcDir, function(err, files) {
@brianblakely
brianblakely / vscode-update.sh
Last active December 23, 2019 17:25
Update or install VS Code on RHEL, Fedora, and CentOS based distributions.
#!/bin/sh
echo 'Beginning Visual Studio Code update.'
sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
sudo sh -c 'echo -e "[code]\nname=Visual Studio Code\nbaseurl=https://packages.microsoft.com/yumrepos/vscode\nenabled=1\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc" > /etc/yum.repos.d/vscode.repo'
sudo dnf check-update
sudo dnf install code
@brianblakely
brianblakely / .bash_profile
Last active September 11, 2020 18:34
My Bash Prompt
test -f ~/.profile && . ~/.profile
test -f ~/.bashrc && . ~/.bashrc
@brianblakely
brianblakely / stars.css
Created June 21, 2012 20:47
Star Rules
* {
/* makes border and padding grow inward from width & height
- mix-and-match units for various box model properties
- ex. width: 25%; padding: 15px;
- no workie in IE7
*/
-moz-box-sizing: border-box;
box-sizing: border-box;
/* hiding overflow creates a block formatting context
@brianblakely
brianblakely / config
Last active February 26, 2021 17:02
SSH Per-Domain Config
Host DOMAIN
HostName DOMAIN
User USERNAME
IdentityFile PRIVATE_KEY_FILE
IdentitiesOnly yes