Skip to content

Instantly share code, notes, and snippets.

@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
},
//
// ECMAScript 6 Cheat Sheet
//
//////////////////////////////////////////////////////////////////////
//---------------------------------------------------------------
// Arrows (and this)
//---------------------------------------------------------------

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 $
@cmalven
cmalven / webkit-placeholder-fade.css
Created March 25, 2013 19:02
Sets webkit placeholder text to disappear after a focus delay instead of after typing.
[placeholder]:focus::-webkit-input-placeholder {
transition: opacity 0.5s 0.5s ease;
opacity: 0;
}
@cmalven
cmalven / svg-bg-fallback.css
Created March 25, 2013 19:03
SVG background images fallback using CSS multiple backgrounds.
.module {
background: url('logo.png');
background: none, url('logo.svg');
}
@cmalven
cmalven / config.php
Created May 4, 2013 14:26
Basic ExpressionEngine Config File
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
// Site basics
$config['app_version'] = '252';
$config['install_lock'] = "";
$config['license_number'] = "1253-2348-9481-3149";
$config['debug'] = '1';
$config['site_label'] = 'CSAJ';
$config['is_system_on'] = "y";