Skip to content

Instantly share code, notes, and snippets.

View jjulian's full-sized avatar

Jonathan Julian jjulian

  • MD
  • 21:06 (UTC -04:00)
View GitHub Profile
@jjulian
jjulian / stream.rb
Created September 18, 2012 12:42 — forked from davetroy/stream.rb
Capture tweets for a given lat/lon bounding box
#!/usr/bin/env ruby
$: << File.dirname(__FILE__)
require 'rubygems'
require 'eventmachine'
require 'em-http' # gem name em-http-request
require 'yajl'
require 'yajl/json_gem'
class Streamer
@jjulian
jjulian / utils.js
Created August 7, 2012 20:55
Backbone.js collection upsert
App.Utils = {
refreshCollection: function( collection, collectionJSON ){
// update/add
_( collectionJSON ).each( function( modelJSON ) {
modelJSON._touched = true; // MARK THE ONES TO KEEP
var model = collection.get( modelJSON.id );
if( model ) {
model.set( modelJSON );
} else {
collection.add( modelJSON );
@jjulian
jjulian / gist:2520936
Created April 28, 2012 18:08
Advice on moving to Baltimore

Derek Sivers wrote an interesting post (http://sivers.org/la) as advice for folks moving to LA. Here's my thoughts on the same topic, but about Baltimore, MD.

I moved into South Baltimore in 1996 and I've lived in this neighborhood ever since. Here are a few of my thoughts (please fork and edit):

  • Baltimore is made up of many different neighborhoods. Getting to know the character of each of the them will enhance your experience. Visiting the baseball stadium and going to dinner in the Inner Harbor does not make for a satisfying Baltimore-experience. You have to get it into the neighborhoods to find the truly great food, the fun bars, and genuine people.

  • "The Wire" is real, but you probably won't see it. Unless you're visiting your cousin who lives on West Lanvalle, you probably won't see much that resembles a Barksdale corner. And don't ask for a "Wire Tour" - that's not what we're about.

  • People are friendly, especially the older folks. If you have a chance, take a pause to listen to their story, o

https://accounts.google.com/o/openid2/auth?openid.assoc_handle=AMlYA9UJBozPiJiAA8zy3HG1MgQ8g8y3nqPVtMjdoOXutcKd3buWSITu
openid.ax.if_available=ext0,ext1,ext3,ext4,ext7
openid.ax.mode=fetch_request
openid.ax.required=ext2,ext5,ext6,ext8
openid.ax.type.ext0=http://axschema.org/namePerson/friendly
openid.ax.type.ext1=http://axschema.org/media/image/aspect11
openid.ax.type.ext2=http://axschema.org/namePerson/last
openid.ax.type.ext3=http://axschema.org/contact/state/home
openid.ax.type.ext4=http://axschema.org/contact/city/home
openid.ax.type.ext5=http://axschema.org/namePerson/first
@jjulian
jjulian / apache.conf
Created February 23, 2012 03:38
Apache rewrite rules to show a maintenance page
# Capistrano-style: if maintenance.html exists, it will be served for any request
# other than style and images. Use status code 503 to tell crawlers to come back later.
ErrorDocument 503 /system/maintenance.html
RewriteEngine On
RewriteCond %{REQUEST_URI} !\.(css|gif|jpg|png)$
RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f
RewriteCond %{SCRIPT_FILENAME} !maintenance.html
RewriteRule ^.*$ - [redirect=503,last]
@jjulian
jjulian / example.erb
Created February 18, 2012 16:44
Running Ruby under Apache like PHP, using cgi - http://stackoverflow.com/a/1901772/231245
<% header "Content-Type" => "text/html" %>
<h1>Let's run some ruby code: <%= rand %></h1>
@jjulian
jjulian / hide-button.html
Created November 2, 2011 20:35
Shortmail widget: you are going to use your own link, so hide the button
<script src="http://shortmail.com/widgets/compose-widget.js?v=1"></script>
<script>
Shortmail.ComposeWidget({
screenName: '[email protected]'
});
$(document).ready(function() {
// hide the button
$('button.shortmail-me').hide();
});
</script>
@jjulian
jjulian / cmd_line_script.rb
Created June 15, 2011 15:06
A sample script that uses OptionParser and Logger. A great template to start with! Shown off at @bmoreonrails on June 14, 2011
# A sample script that uses OptionParser and Logger
# http://www.ruby-doc.org/stdlib/libdoc/optparse/rdoc/classes/OptionParser.html
require 'optparse'
require 'logger'
# Defaults. This hash will hold all of the options
# parsed from the command-line by
# OptionParser.
options = {
:verbose => false,
@jjulian
jjulian / WTF.js
Created February 21, 2011 11:09 — forked from scottmessinger/WTF.js
Helping Scott M with $.ajax
// We all overlooked the fact that there was no "callback" for the response
// Ajax is asynchronous
$.ajax({
url : '/plans.json',
success: function(json, status, xhr) {
console.log("request is complete");
console.log(json[0].plan.created_at);
}
});
@jjulian
jjulian / enough_design_to_be_dangerous.html
Created February 9, 2011 15:24
Example html/css as seen in "Enough Design to be Dangerous" at Bmore on Rails, Feb 8, 2011
<html>
<head>
<style>
body { background-color:#fff; color:#333; font-family: sans-serif; font-size: 36px; margin: 50px 50px; }
p { margin: 10px; }
hr { margin:50px 0; }
.colors { width:100%; }
.colors .c { float:left; padding:5px 10px; line-height: 50px; width: 90px; height: 50px; margin: 5px; text-transform:uppercase; }
.textcolor h1 { color: #000; margin-bottom: 5px; }
.textcolor p { color: #666; }