Skip to content

Instantly share code, notes, and snippets.

View ungoldman's full-sized avatar
🤔
💭

Nate Goldman ungoldman

🤔
💭
View GitHub Profile
@ungoldman
ungoldman / README
Created April 11, 2011 06:39
Fixing _why's Evil Idea Encoder
Fixing _why's Evil Idea Encoder
==============================
Working my way through _why's (poignant) guide to ruby, I noticed that
the more complex his examples became, the less often they actually
worked when tested. Frustrated by my inability to copy and paste examples
into the shell and see them work without doing any real learning, I
grudgingly decided to find a way to bring his examples to life and satisfy
my obsessive need for results and tidiness.
@ungoldman
ungoldman / example.html
Created October 24, 2011 23:02
ga click tracking w/ data attributes
<!DOCTYPE HTML>
<html lang='en-US'>
<head>
<meta charset='UTF-8'>
<title></title>
</head>
<body>
<a data-ga='play' data-context='game'>Play</a>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>
@ungoldman
ungoldman / script.js
Created November 1, 2011 20:43
Chrome "Display forbidden by X-Frame-Options" link fix
// Stuck in an iframe? Link throwing an error in Chrome?
// This jQuery snippet will make sure that every link and submit
// without a specified target will open at the window.top.location level.
jQuery(function($){
$(document).on('click', 'a, :submit', function() {
var t = $(this)[0].target; if (t === '') t = '_top';
});
});
@ungoldman
ungoldman / example.html
Created January 5, 2012 03:02
google maps example
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
#map_canvas {
height: 300px;
width: 300px;
}
@ungoldman
ungoldman / .bash_profile
Created January 9, 2012 18:54
get git branch info in bash cli
# git branch bedazzler (.each_line added before .grep for 1.9.x)
# http://asemanfar.com/Current-Git-Branch-in-Bash-Prompt
export PS1="\[\033[32m\]ツ\[\033[0m\] \[\033[37m\]\u@\h\[\033[01;34m\] \w \[\033[31m\]\`ruby -e \"print (%x{git branch 2> /dev/null}.each_line.grep(/^\*/).first || '').gsub(/^\* (.+)$/, '(\1) ')\"\`\[\033[37m\]$\[\033[00m\] "
@ungoldman
ungoldman / example.html
Created January 31, 2012 22:44
backup slidedown jquery example
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
ul.backups { display: none; }
</style>
</head>
<body>
@ungoldman
ungoldman / float_this.html
Created February 24, 2012 00:16
better clearfix hack (tutorial)
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<style type="text/css">
/* nicholas gallagher's tiny clearfix */
@ungoldman
ungoldman / test.html
Created February 28, 2012 01:10
Serializing JavaScript Objects
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<script type="text/javascript">
var params = {
postcard: {
@ungoldman
ungoldman / notes.md
Created March 9, 2012 08:42
better web application architecture: html5/css/js web app + api server + auth server

Highly decoupled functionality

  • API Server
  • Auth Server
  • Web App

All separate codebases

  • User hits web app, redirects to auth server
  • User logs in
@ungoldman
ungoldman / fizzbuzz.js
Created August 3, 2012 20:50
Quest for the Shortest FizzBuzz
for (var i=1;i<=100;i++){
var s = '';
if (i % 3 === 0) s += 'Fizz';
if (i % 5 === 0) s += 'Buzz';
console.log(s ? s : i);
}