Skip to content

Instantly share code, notes, and snippets.

View dandean's full-sized avatar
🌧️
It's raining.

Dan Dean dandean

🌧️
It's raining.
View GitHub Profile
require 'net/dns/resolver'
# Custom Domain
#
# Require net-dns gem
#
# A Rack middleware to to resolve the custom domain to original subdomain
# for your multi telent application.
#
# It's all transperant to your application, it performs cname lookup and
@dandean
dandean / gist:313617
Created February 24, 2010 17:01 — forked from gf3/gist:143893
Many times, when creating a site, I need hidden elements on a page that I must later make visible. Of course it would
be great if one could simply hide them via CSS, and later [easily] show them via javascript. However this is not the
case, javascript has some difficulties overriding styles set in a stylesheet. So, I've found the best way to
accomplish this is to use a combo of CSS and javascript in a two-step process:
1. Hide the elements via CSS class – so they are hidden when the user first sees the page
2. Hide the elements via javascript and remove the corresponding CSS class, after the DOM has loaded.
The second step has the potential to be quite expensive on the DOM, but I feel that it's an acceptable trade-off
because the elements in question are already hidden. This way they are ready to be manipulated, one doesn't need to
// Untested. Requires Prototype >= 1.6
//
// Copyright (c) 2009 Tobie Langel
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:

(This is the text of the keynote I gave at Startup Riot 2009. Will update when video becomes available.)

Hi everyone, I’m Chris Wanstrath, and I’m one of the co-founders of GitHub.

GitHub, if you haven’t heard of it, has been described as “Facebook for developers.” Which is great when talking about GitHub as a website, but not so great when describing GitHub as a business. In fact, I think we’re the polar opposite of Facebook as a business: we’re small, never took investment, and actually make money. Some have even called us successful.

Which I’ve always wondered about. Success is very vague, right? Probably even relative. How do you define it?

After thinking for a while I came up with two criteria. The first is profitability. We employ four people full time, one person part time, have thousands of paying customers, and are still growing. In fact, our rate of growth is increasing – which means January was our best month so far, and February is looking pretty damn good.

so my workflow is that each ticket gets a branch. Before merging the branch to master
it needs to be peer-reviewed. So sometimes I have a bunch of branches that are off
being reviewed while I work on something else.
Currently when I run "git branch" I see:
[branch 1]
[branch 2]
[branch 3]
*[branch 4]
[branch 5]
@dandean
dandean / gist:552319
Created August 26, 2010 21:45 — forked from gf3/gist:166083
// Truncate a string to the closest word
String.prototype.truncateToWord = function(length) {
return this
.slice(0, length + 1)
.split(/\s+/)
.slice(0, -1)
.join(" ");
};
// Examples
var App = function() {
var musicLoopFlag = 0,
delay = null,
frameNumber = 0,
afterFirstLoop = 0,
self = this;
this.setup = function() {
var assetCount = 59; // One for each image in the animation, plus one for the intro and one
// for the loop of the song
<!DOCTYPE html>
<html lang="en">
<head>
<script type="text/javascript" src="soundmanager/script/soundmanager2.js"></script>
<script type="text/javascript" src="index.js"></script>
<title>Grrrr!</title>
</head>
<body>
<p id="debug1">Nothing works! &hearts;</p>
var TitleWrapper = function()
{
/* .
. Blah blah blah
. */
var onMute = function()
{
@dandean
dandean / gist:956063
Created May 4, 2011 21:21 — forked from fling/gist:956023
Page Control CSS
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=724, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<title>Page Control</title>
<style>