Skip to content

Instantly share code, notes, and snippets.

View markbrown4's full-sized avatar

Mark Brown markbrown4

View GitHub Profile
@markbrown4
markbrown4 / server.js
Created March 9, 2012 07:19
A simple node server for serving front-end code
var http = require('http');
var fs = require('fs');
var path = require('path');
http.createServer(function (request, response) {
var filePath = '.' + request.url;
if (filePath == './')
filePath = './index.htm';
@markbrown4
markbrown4 / Rakefile
Created March 9, 2012 07:21
Rake task for combining & compressing javascript files using Sprockets & uglifier
assets = %w{application}
task :compile do
require 'sprockets'
environment = Sprockets::Environment.new(File.dirname(__FILE__))
environment.append_path 'src/'
assets.each do |asset|
@markbrown4
markbrown4 / pushStateOrNothing.js
Created March 24, 2012 07:58
pushState partial page updates
$('body').on('click', '.partial', function() {
if (Modernizr.history) {
$('#content').load(this.href, function() {
history.pushState(null, this.title, this.href);
});
return false;
}
}
@markbrown4
markbrown4 / dabblet.css
Created August 1, 2012 09:20
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
div {
background: #eee;
height: 650px;
background-image: linear-gradient(
transparent,
transparent 50px,
@markbrown4
markbrown4 / dabblet.css
Created August 1, 2012 09:20
webkit y u blur with large background-size?
/**
* webkit y u blur with large background-size?
*/
div {
height: 1200px;
background-color: #eee;
background-image: linear-gradient(top,
transparent,
transparent 250px,
@markbrown4
markbrown4 / dabblet.css
Created August 1, 2012 11:26
webkit y u know 1px rule with linear-gradient?
/**
* webkit y u know 1px rule with linear-gradient?
*/
div {
background: #eee;
height: 650px;
background-image: linear-gradient(
transparent,
transparent 50px,
@markbrown4
markbrown4 / dabblet.css
Created August 6, 2012 08:11
-webkit-background-clip: text; causes blurry text on retina display
/**
* -webkit-background-clip: text; causes blurry text on retina display
*/
html { -webkit-text-size-adjust: none }
h1 {
color: #535353;
font: lighter 50px/1 Helvetica;
background: -webkit-gradient(linear, left top, left bottom, from(#000), to(#535353));
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
@markbrown4
markbrown4 / dabblet.css
Created August 16, 2012 01:19
svg in webkit cropping content with rotation
/**
* svg in webkit cropping content with rotation
*/
.pie {
width: 152px;
height: 152px;
margin: 0 auto;
background: rgba(0,0,0, .05);
box-shadow: 0 0 20px rgba(0,0,0, .2) inset;
@markbrown4
markbrown4 / rogie.tmTheme
Created August 16, 2012 04:02
Textmate theme for a code snippet designed by Rogie dribbble.com/shots/26026-Code-Sample
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>author</key>
<string>Mark Brown</string>
<key>name</key>
<string>Rogie</string>
<key>settings</key>
<array>
@markbrown4
markbrown4 / prism.rails.js
Created August 22, 2012 23:32
Prism Rails theme HTML, CSS, Javascript, Ruby, Coffeescript, Haml
// borrowed from https://github.com/samflores
Prism.languages.ruby = {
'comment': /#[^\r\n]*(\r?\n|$)/g,
'string': /("|')(\\?.)*?\1/g,
'regex': {
pattern: /(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\r\n])+\/[gim]{0,3}(?=\s*($|[\r\n,.;})]))/g,
lookbehind: true
},
'keyword': /\b(alias|and|BEGIN|begin|break|case|class|def|define_method|defined|do|each|else|elsif|END|end|ensure|false|for|if|in|module|new|next|nil|not|or|raise|redo|rescue|retry|return|self|super|then|throw|true|undef|unless|until|when|while|yield)\b/g,
'builtin': /\b(Array|Bignum|Binding|Class|Continuation|Dir|Exception|FalseClass|File|Stat|File|Fixnum|Fload|Hash|Integer|IO|MatchData|Method|Module|NilClass|Numeric|Object|Proc|Range|Regexp|String|Struct|TMS|Symbol|ThreadGroup|Thread|Time|TrueClass)\b/,