Skip to content

Instantly share code, notes, and snippets.

View hoganlong's full-sized avatar

Hogan Long hoganlong

View GitHub Profile
@AndersDJohnson
AndersDJohnson / input-height.less
Last active June 5, 2019 13:35
Normalize vertical centering of form items across browsers.
/**
* This will normalize vertical centering of input text across browsers.
*/
.mixin-input-height (@font-size, @height-scale: 2.5) {
@input-height: @font-size * @height-scale;
@input-padding-vertical: (@input-height - @font-size) / 2;
font-size: @font-size;
height: @input-height + 2; // webkit seems to have a weird 1px gap
// to vertically center input text in IE <= 8, but not stretch caret in modern browsers
@creationix
creationix / app.js
Last active November 10, 2017 06:28
This is a science experiment showing how the new process.addAsyncListener API in node 0.12.x could be (ab)used to create a very easy to use web-framework.
module.exports = function () {
// If there is an uncaught exception anywhre in your app, it will result in a proper 500 page.
if (Math.random() < 0.3) throw new Error("Oops, my random is low");
// They don't have to happen in the first tick either
if (Math.random() < 0.2) return setTimeout(function () {
throw new Error("Delayed random bites");
});
// If you throw an object, it will send a JSON document to the client
if (Math.random() > 0.6) throw {Hello: request.url};
@hoganlong
hoganlong / gist:1683075
Last active September 29, 2015 23:07
Links to git based blog engines (and others of direct interest)
Blog post on jekyll and gh-pages functionality
http://haacked.com/archive/2013/12/02/dr-jekyll-and-mr-haack/
Balrog
Node based static site generator
https://github.com/jlord/balrog
Example >> https://github.com/jlord/jlord.github.io
GitPress (Python / Node backend)
https://github.com/joeyespo/gitpress
@dahlbyk
dahlbyk / .gitattributes
Created July 13, 2011 16:05
C# .gitattributes
*.cs diff=csharp
@lorn
lorn / gist:976873
Created May 17, 2011 17:12 — forked from medecau/opcp.md
Online Programming Contests and Puzzles
@Benjol
Benjol / selfupdatingscript.user.js
Created March 17, 2011 09:33
SelfUpdatingUserScript
// ==UserScript==
// @name SelfUpdatingScript
// @version 1.0.0
// @namespace Benjol (http://stackoverflow.com/users/11410/benjol)
// @description Template script for a self-updating script
// @credits Kudos to http://stackoverflow.com/users/115866/balpha
// @include https://gist.github.com/*
// ==/UserScript==
function with_jquery(f) {
function randomChoice(arr) {
return arr[Math.floor(Math.random() * arr.length)];
}
function randint(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
function drawCircleANotFilled(ctx, x, y, radius, width, color) {
ctx.beginPath();
/*!
* $imple cache - v0.3pre - 07/15/2010
* http://benalman.com/
*
* Copyright (c) 2010 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*/
(function($,window){