Skip to content

Instantly share code, notes, and snippets.

View andyvanee's full-sized avatar

Andy Vanee andyvanee

View GitHub Profile
@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 / 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\//'`
}
<!DOCTYPE html>
<html>
<head>
<title>async</title>
</head>
<body>
<div id="async-scripts">Social widgets will go here...</div>
<div>Page contents here...</div>

internet topology

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

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

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
@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;
}
.gen-float(@name) {
.float-@{name} {
float: @name;
}
}
body {
.a{ .gen-float(left); }
.b{ .gen-float(right); }
}
@andyvanee
andyvanee / jquery.paging.js
Created October 29, 2013 21:02
Pagination
jQuery(function($){
/*
jQuery.paging - simple pagination
*/
$.fn.paging = function(options) {
var $base = this,
base_sel = $base.selector,
defaultOpts = {
@andyvanee
andyvanee / domload.js
Last active December 23, 2015 10:09
Headless speed testing of multiple sites from 0 to DOMContentLoaded
// Run with PhantomJS
// phantomjs domload.js http://example.com
// emits milliseconds from init to DOMContentLoaded
var args = require('system').args;
var page = require('webpage').create(),
url = args[1];
page.onLoadStarted = function () {
@andyvanee
andyvanee / test.php
Created September 16, 2013 18:21
Stupid wordpress theme using post_parent. Manually change a bunch
<?php
for ($i=0; $i < 150; $i++) {
$attachments = get_posts( array(
'post_type' => 'attachment',
'posts_per_page' => -1,
'post_parent' => $i,
'exclude' => get_post_thumbnail_id()
) );