Skip to content

Instantly share code, notes, and snippets.

View xjamundx's full-sized avatar

Jamund Ferguson xjamundx

View GitHub Profile
@xjamundx
xjamundx / fluentconfnotes.md
Created June 4, 2012 15:35
Notes from FluentConf 2012

General Dev Notes

  1. Fast development is important
    • good IDEs, local development, fast servers
    • linting in the IDE / as soon as possible
    • live reload CSS
  2. Fast testing is important as well
    • make it easy to see test results soon
    • commit-hooks? CI server?
@xjamundx
xjamundx / html5-quiz.md
Created May 25, 2012 13:24
HTML5 Quick
  1. Which one of these produces an incorrect document outline?

a.

<body>
	<h1>My Page</h1>
	<div>
		<h2>My Section</h2>
	</div>	
@xjamundx
xjamundx / Sass-buttons.scss
Created May 4, 2012 03:49
Sass Button Mixins
@import "compass/css3";
// make a button with a lot of help
@mixin btn($bottom: gray, $top: white, $border: black, $highlight: blue, $lowlight: gray, $text: white) {
border: 1px solid $border;
color: $text;
border-radius: 5px;
box-shadow: inset 0 1px 0px $highlight, 0 2px 0px $lowlight;
text-shadow: 0px -1px 0px rgba(100, 100, 100, .5);
background: $bottom;
@xjamundx
xjamundx / weirdcss.html
Created April 18, 2012 15:28
Weird Font CSS Find
<!doctype html>
<html lang="en">
<head>
<style>
body {
font-face: Sans-Serif;
}
h1 {
font-face: "Fake-Font";
}
@xjamundx
xjamundx / cloud9idfeedback.md
Created March 2, 2012 15:55
Cloud 9 IDE Feedback

"Missing" Features

  • markdown previewer
  • invite a friend (maybe it's only in private mode?)
  • tab completion (Date.[now()]) for example
  • how do i update the files if github has changed?

FireFox 10

  • rename folder not working in FF10
@xjamundx
xjamundx / SassColorPalette.js
Created February 28, 2012 23:22
Sass Color Palette Generator
var $colors = $("#colors");
var url = "/css/sass/_colors.scss";
$.get(url, function(data) {
var lines = data.split("\n");
var line = "";
var parts = [];
for (var i = 0; i < lines.length; i++) {
line = lines[i].trim();
if (!line.match(/^\$/)) continue;
@xjamundx
xjamundx / mongo-map-reduce-speed-test.js
Created January 19, 2012 23:48
mongo map reduce vs query speed test
// map reduce way is slow for querying a count, but fast for creating a new table (~20s)
map = function() {
if (this.alerts && this.alerts.length > 0 && this.apns) {
emit(new ObjectId(), {alerts: this.alerts, uuid: this.uuid, hiddenChannels: this.hiddenChannels, provider: this.provider})
}
}
reduce = function(){}
options = {out:{replace:"alertingUsers"}}
db.users.mapReduce(map, reduce, options)
db.alertingUsers.count() // 34554
@xjamundx
xjamundx / logger.js
Created January 19, 2012 23:24
expres js db logging on top of connect-logger
// use it as a middleware like this
app.use(logger.db('appName')) // by default logs to a db and console.log
app.use(logger.db('appName', false)) // don't log to console.log
// logger.js
var express = require('express')
var logger = express.logger
var RequestLog = require('reports/model/RequestLog')
express.logger.token('route', function(req, res) {
var route = req.route || {}
@xjamundx
xjamundx / uploadapp.js
Created January 18, 2012 04:45
file uploads with express and node.js
// middleware
app.use(express.bodyParser({ keepExtensions: true, uploadDir: __dirname + "/public/uploads" }))
// later
app.get('/photos', uploadFile, addPhoto)
// file is automatically saved to /public/uploads, let's just set
function uploadFile(req, res, next) {
if (req.files) {
req.body.url = "http://myawesomesite.com/" + req.files.file.path.split("/").slice(-2).join("/")
@xjamundx
xjamundx / connect-db-logger.js
Created December 15, 2011 18:02
Use connect-logger to log to a database
// use like this
// var logger = require('connect-db-logger')
// app.use(logger.db("AppName"))
// RequestLog is super simple, but I don't provide it here
var express = require('express')
var logger = express.logger
var RequestLog = require('reports/model/RequestLog')
express.logger.token('route', function(req, res){
return req.route.path;