Skip to content

Instantly share code, notes, and snippets.

View kixxauth's full-sized avatar

Kris Walker kixxauth

View GitHub Profile
@kixxauth
kixxauth / long-polling.html
Created April 11, 2011 01:21
A Node.js http long polling server for HTTP streaming.
<!DOCTYPE html>
<html>
<style type="text/css">
body {
font-size: 18px;
background: #000;
color: #fff;
}
#container {
width: 600px;
@kixxauth
kixxauth / test-redis-scan.js
Last active March 24, 2017 11:36
Oddworks Datastore Scan Tests
'use strict';
const Promise = require('bluebird');
const _ = require('lodash');
const redis = require('redis');
const REDIS_SCAN_PAGES = 5;
const PAGE_SIZE = 20;
Promise.promisifyAll(redis.RedisClient.prototype);
@kixxauth
kixxauth / gist:5190450
Created March 18, 2013 20:19
Vagrant 1.1.1 error
[default] Configuring and enabling network interfaces...
[default] Mounting shared folders...
[default] -- /webapp
[default] -- /vagrant
[default] Forcing shutdown of VM...
[default] Destroying VM and associated drives...
/Applications/Vagrant/embedded/gems/gems/vagrant-1.1.1/plugins/providers/virtualbox/action/prepare_nfs_settings.rb:16:in `call': uninitialized constant VagrantPlugins::ProviderVirtualBox::Action::PrepareNFSSettings::Errors (NameError)
@kixxauth
kixxauth / main.html
Created July 10, 2013 19:10
Link to Twitter App from iBooks Widget
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<link rel="stylesheet" href="style.css">
</head>
<body>
<div id="container">
<h1>Link to an External iOS App</h1>
<section class="static-tweet">
@kixxauth
kixxauth / content1-snippet.xhtml
Last active December 17, 2015 14:49
ibooks unzipped file exploration
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<?xml-stylesheet href='assets/css/content1.css' type='text/css' media='all'?>
<?xml-stylesheet href='assets/css/content1-paginated.css' type='text/css' media='paginated and (orientation:landscape)'?>
<?xml-stylesheet href='assets/css/content1-flow.css' type='text/css' media='nonpaginated and (orientation:portrait)'?>
<html xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ibooks="http://www.apple.com/2011/iBooks" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:epub="http://www.idpf.org/2007/ops" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8"/>
<title>Untitled</title>
<link rel="stylesheet" type="text/xml+svg" href="assets/svg/content1.svg"/>
@kixxauth
kixxauth / contact.php
Last active December 16, 2015 19:00
Contact form email sending in PHP
<?php
// If there were *no* submission errors:
if ($err === 0) {
if (function_exists('htmlspecialchars_decode')) {
$subject = htmlspecialchars_decode($subject);
$message = htmlspecialchars_decode($message);
}
$message .= "\r\nPhoneNumber: " . $phone;
@kixxauth
kixxauth / index.html
Created January 12, 2013 18:07
Avoid parsing JavaScript on older devices. From https://m.lanyrd.com/
<head>
<script>
(function() {
var d = document,
w = window,
de = d.documentElement,
os = w.applicationCache && w.JSON && w.localStorage,
om = window.operamini,
pe = 'pointerEvents' in de.style && !window.opera, // Opera gives false positive
bs = 'backgroundSize' in de.style && !om; // Opera Mini gives false positive
@kixxauth
kixxauth / conditional.html
Created November 29, 2012 13:52
Development Mode in Web Browsers
<script>
// Conditionally load Google Analytics
if (!PAGE.inDevmode) {
var _gaq=[['_setAccount','UA-XXXXX-X'],['_trackPageview']];
(function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];
g.src=('https:'==location.protocol?'//ssl':'//www')+'.google-analytics.com/ga.js';
s.parentNode.insertBefore(g,s)}(document,'script'));
}
@kixxauth
kixxauth / backbone-one.js
Created November 19, 2012 16:56
Backbone.js Single Event Listener Registration
Backbone.Events.one = function (events, callback, context) {
var self = this;
function wrapper() {
self.off(events, wrapper, context);
callback.apply(this, arguments);
}
this.on(events, wrapper, context);
};
@kixxauth
kixxauth / broken.html
Created October 11, 2012 10:18
Good Modal Dialogs
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Sane Modal</title>
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="positioned.css">
</head><body>
<div id="base-layer">