Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<!-- Make a DNS handshake with a foreign domain, so the connection goes faster when the user eventually needs to access it. This works well for loading in assets (like images) from another domain, or a JavaScript library from a CDN. -->
<link rel="dns-prefetch" href="//ajax.googleapis.com" />
<link rel="dns-prefetch" href="//s3.amazonaws.com" />
<!-- Make sure the latest version of IE is used -->
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
@kublaj
kublaj / index.html
Last active August 29, 2015 14:15 — forked from PeterTheOne/index.html
<!doctype html>
<html lang="en"><!-- or "de" -->
<head>
<meta charset="utf-8" />
<title>Style links by hreflang</title>
</head>
<body>
<!-- this link will have "de" appended -->
<a href="http://petergrassberger.at/" hreflang="de">German Site</a>
<!-- this link will stay the same because the site lang is "en" -->

Using Homebrew to manage Node.js and io.js installs on OSX

Having both Node.js and io.js installed with NVM was giving me a load of problems, mainly with npm. So I uninstalled NVM and manage Node.js and io.js with homebrew.
Heres how.

Install Node.js and io.js

$ brew install node
$ brew install iojs

@kublaj
kublaj / .htaccess
Last active August 29, 2015 14:13 — forked from thoop/.htaccess
# Change YOUR_TOKEN to your prerender token and uncomment that line if you want to cache urls and view crawl stats
# Change http://example.com (at the end of the last RewriteRule) to your website url
<IfModule mod_headers.c>
#RequestHeader set X-Prerender-Token "YOUR_TOKEN"
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
@kublaj
kublaj / my.css
Created January 14, 2015 14:45 — forked from anonymous/my.css
CSS3 gradient animation http://www.gradient-animator.com
background: linear-gradient(270deg, #c9dcd7, #80a097, #588f7f, #164034, #8b8b2a, #4f4f19, #c597dc, #8d2887, #3faede, #6b1631, #a5697c, #ebe7e8, #668d4a, #75d82d, #2a4417, #c76921);
background-size: 3200% 3200%;
-webkit-animation: AnimationName 59s ease infinite;
-moz-animation: AnimationName 59s ease infinite;
-o-animation: AnimationName 59s ease infinite;
animation: AnimationName 59s ease infinite;
@-webkit-keyframes AnimationName {
    0%{background-position:0% 50%}
    50%{background-position:100% 50%}
    100%{background-position:0% 50%}
@kublaj
kublaj / README.md
Last active August 29, 2015 14:13 — forked from mattdesl/README.md

tiny modules

Lately there's been some discourse on so-called module shaming1 — which can go both ways — with lots of confusion and misinformation all around.

So let's get to the meat of the topic: why would anyone publish a single-function module?

It might seem odd to have a module with just a single function (examples: clamp, lerp, is-clockwise, xtend, point-in-polygon). Sometimes your tests and documentation are longer than the function itself. Let's examine some of the benefits to this approach...

  • a terse and frozen API does not end up wit
// Node.js CheatSheet.
// Download the Node.js source code or a pre-built installer for your platform, and start developing today.
// Download: http://nodejs.org/download/
// More: http://nodejs.org/api/all.html
// 0. Synopsis.
// http://nodejs.org/api/synopsis.html
# NPM CheatSheet.
# Super easy intall: npm comes with node now.
# To create your own npm package: https://www.npmjs.org/doc/misc/npm-developers.html
# More: https://www.npmjs.org/doc/
# 1. NPM Command Lines.
# Local mode is the default.
# Use --global or -g on any command to operate in global mode instead.

The idea is to have nginx installed and node installed. I will extend this gist to include how to install those as well, but at the moment, the following assumes you have nginx 0.7.62 and node 0.2.3 installed on a Linux distro (I used Ubuntu).

In a nutshell,

  1. nginx is used to serve static files (css, js, images, etc.)
  2. node serves all the "dynamic" stuff.

So for example, www.foo.com request comes and your css, js, and images get served thru nginx while everything else (the request for say index.html or "/") gets served through node.

  1. nginx listens on port 80.
<?php
/*
GeoRSS formatted output for Google Maps
Authors: Alastair Mucklow, Chris Toppon
*/
//header('Content-Type: ' . feed_content_type('rss-http') . '; charset=' . get_option('blog_charset'), true);
//$more = 1;
echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'" standalone="yes"?'.'>'; ?>