Skip to content

Instantly share code, notes, and snippets.

@rstacruz
rstacruz / styleguides.md
Created February 13, 2014 02:07
Styledown example

Fancy style guide

Buttons

Add a class of .button to a `` or <a> element, and use a size

Here's a simple Mocha test case. It emulates chai.js's expect(a).eq(b) behavior.

it('comparing strings', function () {
  var string1 = "div, p {\n  color: red;\n  margin: 0;\n  padding: 0;\n}";
  var string2 = "div, p {\n  color: red;\n  margin: 20px;\n  padding: 0;\n}";

  var e = new Error("Strings don't match");
  e.expected = string1;
 e.actual = string2;
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-2.1.1.min.js"></script>
<script src="http://fb.me/react-with-addons-0.12.0.js"></script>
<meta charset="utf-8">
<title>React</title>
<style id="jsbin-css">
html, body {
height: 100%;

Bootstrap grid classes in the markup: (bleh)

<div class="panel">
  <div class="panel-body">
    <div class="col-sm-8">
      <div class="col-xs-4 col-sm-6">Username:</div>
      <div class="col-xs-8 col-sm-6"><input type='text'></div>
      <div class="col-xs-4 col-sm-6">Password:</div>
      <div class="col-xs-8 col-sm-6"><input type='password'></div>
#!/usr/bin/env sh
pwd="`pwd`"
dirs=*
code=0
while [[ "$1" =~ ^- && ! "$1" == "--" ]]; do case $1 in
-q | --quiet )
quiet=1
;;
-i | --ignore-errors )
# Also tried:
# sudo easy_install pycurl
# export ARCHFLAGS="-arch x86_64" && sudo easy_install pycurl
# etc...
$ sudo easy_install pycurl==7.16.2.1
Searching for pycurl==7.16.2.1
Reading http://pypi.python.org/simple/pycurl/
Reading http://pycurl.sourceforge.net/
class Shape
def self.desc(str)
@@description = str
end
def self.description
@@description
end
end
def pcall(object, meth, &blk)
begin
object.send meth
rescue
return if exception.nil?
raise blk.call
end
end
module Sinatra::Context
def self.registered(app)
app.extend ClassMethods
end
module ClassMethods
def context(prefix='', &b)
Context.new(prefix, self).instance_eval(&b)
end
end