Skip to content

Instantly share code, notes, and snippets.

// This #include statement was automatically added by the Particle IDE.
#include "HttpClient/HttpClient.h"
int button_blue = D0;
int button_red = D1;
int button_reset = D2;
int led = D7;
bool latch_blue = false;
// Set up line-height and colour defaults for this mixin.
$line-height: 20px!default;
$line-color: #94d4ff!default;
/**
*
* Baseline Mixin
* Handy dandy mixin to provide a baseline for your typography.
*
* The mixin carries two arguments — the $baseline, which should match your line-height, and $baseline-color, the colour you want the lines to be.

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

// Boring
if (isThisAwesome) {
alert('yes'); // it's not
}
// Awesome
isThisAwesome && alert('yes');
// Also cool for guarding your code
var aCoolFunction = undefined;
#!/usr/bin/env bash
# fresh-chrome
#
# Use this script on OS X to launch a new instance of Google Chrome
# with its own empty cache, cookies, and user configuration.
#
# The first time you run this script, it will launch a new Google
# Chrome instance with a permanent user-data directory, which you can
# customize below. Perform any initial setup you want to keep on every
run "sed --in-place '/turbolinks/d' Gemfile"
run "sed --in-place '/turbolinks/d' app/assets/javascripts/application.js"
run "sed --in-place '/coffee/d' Gemfile"
run "sed --in-place '/jbuilder/d' Gemfile"
run "sed --in-place 's/, \"data-turbolinks-track\" => true//' app/views/layouts/application.html.erb"
gem 'active_model_serializers'
// Straightforward + simple.
$("button").on("click", function(event) {
event.preventDefault();
var button = $(this);
var numberElem = button.find(".number");
var number = Number(numberElem.text()) - 1;
numberElem.text(number);
if (number === 0) {
button.prop("disabled", true);
button.off("click");

There are these really awesome cases when Webkit is not only applying default styles to DOM elements that you probably don't want in your design, but then there are these really awesome cases when Webkit is applying these styles inline. DOH!

Webkit will default style input fields with rounded corners and a cute little drop shadow. The easy solution around this is to undo the default styling. And in attempts to be future proof and since others are following in the footsteps of Webkit, lets use some Compass magic to make this easier.

Lets use the power of Placeholder Selectors and a Compass Mixin to make this:

%remove-default-appearance
  +experimental(appearance, none !important)
.fixed {
position: fixed;
top: 0;
}
// ----
// Sass (v3.2.10)
// Compass (v0.13.alpha.4)
// ----
// http://coding.smashingmagazine.com/2013/08/09/absolute-horizontal-vertical-centering-css/
=absolute-center($width, $height)
width: $width