Skip to content

Instantly share code, notes, and snippets.

Avatar

Chris Malven cmalven

View GitHub Profile
@cmalven
cmalven / index.html
Last active Nov 7, 2020
Shortest (useful) HTML5 Document
View index.html
<!-- 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>
View meta-viewport-examples.html
<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">
View cmal-fresh-mac-setup.md

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 Nov 10, 2012
Sublime Project File Exclude SASS
View exclude-sass.sublime-project
{
"folders":
[
{
"path": "root-project-folder",
"folder_exclude_patterns": ["css", ".sass-cache"]
}
]
}
@cmalven
cmalven / basic-js-object.js
Last active Oct 13, 2015
Basic Javascript Object
View basic-js-object.js
function MyObject(options) {
/*****************************************
/* PRIVATE VARS
/****************************************/
var self = {
}
View meteor-accounts-notes.coffee
# 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()
View meteor-mongo-updating.js
// Replaces all of Vote.users array
Votes.update(
{_id: '32dc6fa5-052e-4e2c-8a90-4bd235bf3b0d'},
{
$set: {
'users': [
{
id: '2f537a74-3ce0-47b3-80fc-97a4189b2c15',
vote: 0
},
View gist:4708476

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 */ }
View jquery-plugin-coffeescript.coffee
# Reference jQuery
$ = jQuery
# Adds plugin object to jQuery
$.fn.extend
# Change pluginName to your plugin's name.
pluginName: (options) ->
# Default settings
settings =
option1: true
View basic-vim-commands.md

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 $
You can’t perform that action at this time.