Skip to content

Instantly share code, notes, and snippets.

View andyvanee's full-sized avatar

Andy Vanee andyvanee

View GitHub Profile
.gen-float(@name) {
.float-@{name} {
float: @name;
}
}
body {
.a{ .gen-float(left); }
.b{ .gen-float(right); }
}
@andyvanee
andyvanee / server
Last active August 29, 2015 13:57
Quickly fire up nginx to serve any directory
#!/usr/bin/env ruby
CONF_FILE = '/tmp/server.nginx.conf'
PORT = 8080
NGINX_CONF = <<-eos
worker_processes 1;
events {
worker_connections 1024;
}
var sample = {
template: "<!DOCTYPE html><html><head><title>{title}</title></head><body><p>{content1}</p><p>{content2}</p><p>{content3}</p><p>{content4}</p><p>{content5}</p><p>{content6}</p><p>{content7}</p><p>{content8}</p><p>{content9}</p><p>{content10}</p><p>{content11}</p><p>{content12}</p><p>{content13}</p><p>{content14}</p><p>{content15}</p><p>{content16}</p><p>{content17}</p><p>{content18}</p><p>{content19}</p><p>{content20}</p></body></html>"
, data: {
title : "Sample Page"
, content1 : "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
, content2 : "Lorem ipsum dolor sit amet, consectetur

internet topology

           +–––––––––––––+              
    +––––––+The internets+–––––+        
    |      +–––––––––––––+     |        
    |                          |        
    |                          |        
+–––+–––+              +–––––––+–––––––+
|  Me   |              | Everyone else |

+–––––––+ +–––––––––––––––+

<!DOCTYPE html>
<html>
<head>
<title>async</title>
</head>
<body>
<div id="async-scripts">Social widgets will go here...</div>
<div>Page contents here...</div>
@andyvanee
andyvanee / open-in-github.sh
Created July 9, 2014 20:40
Alias to open the first github.com remote from the current directory in a browser
github(){
open `git remote -v | grep github.com | head -n 1 | cut -f 2 | cut -d' ' -f 1 | sed 's/git@/http:\/\//' | sed 's/.git$//' | sed 's/github.com:/github.com\//'`
}
@andyvanee
andyvanee / github.sh
Created October 16, 2014 22:13
Open in github
github () {
open `git remote -v | grep github.com | head -n 1 | cut -f 2 | cut -d' ' -f 1 | sed 's/git@/http:\/\//' | sed 's/.git$//' | sed 's/github.com:/github.com\//'`
}
@andyvanee
andyvanee / nonblocking-typekit.html
Created December 9, 2014 17:43
Non-blocking Typekit.load
<!--
blocking version
<script async src="//use.typekit.net/loj4asn.js"></script>
<script>var try{Typekit.load();}catch(e){}</script>
non-blocking version below uses script async and setInterval. Replace src="" with your own kit URL
-->
<script async src="//use.typekit.net/loj4asn.js"></script>
@andyvanee
andyvanee / id.css
Last active August 29, 2015 14:13
/* id styling has widespread effects */
#site a { padding-left: 10px; }
/* does nothing */
li a { padding-left: 10px; }
/* also does nothing */
.sidebar li:first a { padding-left: 10px; }
/* Another overly specific selector */
@andyvanee
andyvanee / README.md
Last active August 29, 2015 14:13
Front-controller style static HTML

A little experiment in nginx rewrites. Any request for an actual directory within site gets served the index.html page. The client side is responsible for loading data.json from the requested directory and rendering (I'm using react). The client will also implement history management to avoid full-page refreshes.