Skip to content

Instantly share code, notes, and snippets.

@cmalven
cmalven / index.html
Last active April 10, 2024 01:23
Shortest (useful) HTML5 Document
<!-- http://www.brucelawson.co.uk/2010/a-minimal-html5-document/ -->
<!doctype html>
<html lang=en>
<head>
<meta charset=utf-8>
<title>blah</title>
</head>
<body>
<p>I'm the content</p>
@cmalven
cmalven / meta-viewport-examples.html
Created October 28, 2012 19:12
Meta Viewport Examples
<meta name="viewport" content="width=320">
<meta name="viewport" content="width=device-width">
<meta name="viewport" content="initial-scale=1">
<meta name="viewport" content="maximum-scale=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
@cmalven
cmalven / cmal-fresh-mac-setup.md
Last active November 17, 2019 19:03
Fresh Mac Setup

New Computer Setup

Last tested using Mac OS X 10.8 Mountain Lion

Setup Dropbox

Copy Dropbox folder from previous drive to user folder

@cmalven
cmalven / exclude-sass.sublime-project
Created November 10, 2012 14:49
Sublime Project File Exclude SASS
{
"folders":
[
{
"path": "root-project-folder",
"folder_exclude_patterns": ["css", ".sass-cache"]
}
]
}
@cmalven
cmalven / basic-js-object.js
Last active October 13, 2015 07:07
Basic Javascript Object
function MyObject(options) {
/*****************************************
/* PRIVATE VARS
/****************************************/
var self = {
}
@cmalven
cmalven / meteor-accounts-notes.coffee
Created December 4, 2012 03:21
Meteor Accounts Notes
# Meteor working with accounts
# Getting the current user id
user = Meteor.userId()
# Run some stuff whenever a cursor or session changes
Meteor.startup ->
Meteor.autorun ->
if not Session.get('selected')
party = Parties.findOne()
@cmalven
cmalven / meteor-mongo-updating.js
Created December 8, 2012 16:39
Meteor Mongo Updating
// Replaces all of Vote.users array
Votes.update(
{_id: '32dc6fa5-052e-4e2c-8a90-4bd235bf3b0d'},
{
$set: {
'users': [
{
id: '2f537a74-3ce0-47b3-80fc-97a4189b2c15',
vote: 0
},

Below is an excerpt from http://nicolasgallagher.com/about-html-semantics-front-end-architecture/ explaining why you would want to use multiple related classes on an element vs. one class that gets extended in the CSS.

Component modifiers

Components often have variants with slightly different presentations from the base component, e.g., a different coloured background or border. There are two mains patterns used to create these component variants. I’m going to call them the “single-class” and “multi-class” patterns.

The “single-class” pattern

.btn, .btn-primary { /* button template styles */ }
@cmalven
cmalven / jquery-plugin-coffeescript.coffee
Created February 22, 2013 18:34
CoffeeScript jQuery Plugin
# Reference jQuery
$ = jQuery
# Adds plugin object to jQuery
$.fn.extend
# Change pluginName to your plugin's name.
pluginName: (options) ->
# Default settings
settings =
option1: true
@cmalven
cmalven / basic-vim-commands.md
Created March 16, 2013 17:42
Basic Vim Commands

Basic Vim Commands

  1. Two modes, insert and command
  2. Basic movement: h, j, k, and l
  3. Word movement: w, e, b
  4. Number powered movement, e.g. 5w
  5. Insert text repeatedly, e.g. 3iYes
  6. Find a character, f and F
  7. Go to matching parentheses, %
  8. Go to start/end of line, 0 and $