Skip to content

Instantly share code, notes, and snippets.

View epogue's full-sized avatar
Caffeinated

Elliott Pogue epogue

Caffeinated
View GitHub Profile
@tmcw
tmcw / index.html
Created October 17, 2012 13:21
MapBox.js + Retina
<!DOCTYPE html>
<html>
<head>
<script src='http://api.tiles.mapbox.com/mapbox.js/v0.6.6/mapbox.js'></script>
<link href='http://api.tiles.mapbox.com/mapbox.js/v0.6.6/mapbox.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }
#map { position:absolute; top:0; bottom:0; width:100%; }
</style>
</head>
@orderedlist
orderedlist / labels.scss
Created July 9, 2012 18:42
Simple Label Colors with SCSS
$start-color:#2B73A2;
$number: 12;
@for $i from 1 through $number {
.label-#{$i} {
color:adjust_hue($start-color, ($i - 1) * (360 / $number));
}
}
@rlivsey
rlivsey / modal.js.coffee
Created May 24, 2012 09:56
Ember.js modal
MB.ModalHeaderView = Ember.View.extend({
classNames: ["modal-header"]
contentBinding: "parentView.content"
titleBinding: "parentView.title"
defaultTemplate: Ember.Handlebars.compile("""
<a href="#" {{action close target="view.parentView"}} class="close">x</a>
<h3>{{view.title}}</h3>
""")
})
@elliotjaystocks
elliotjaystocks / Art direction in Harmony
Created May 3, 2012 14:33
Art direct your blog posts in Harmony by inserting this loop into the <head> and injecting any extra CSS or JSS you might need by creating a field in your post template called 'injected_code'.
{% if item.root? %}
{{ 'blog' | item_from_path | assign_to: 'blog' }}
{% for post in blog.recent_posts.1 %}
<!-- Injected code from the latest blog post -->
{{ post.data.injected_code }}
{% endfor %}
class ActionDispatch::Routing::Mapper
def draw(routes_name)
instance_eval(File.read(Rails.root.join("config/routes/#{routes_name}.rb")))
end
end
BCX::Application.routes.draw do
draw :api
draw :account
draw :session
@epogue
epogue / app-template.rb
Created March 22, 2012 17:55
Rails 3 app template
require 'open-uri'
run "rm public/index.html"
run "rm .gitignore"
rake "db:migrate"
file ".gitignore", <<-CODE
#{URI.parse("https://raw.github.com/github/gitignore/master/Rails.gitignore").read}
*.sublime-workspace
CODE
@paulnicholson
paulnicholson / powssl
Last active November 24, 2021 16:40
ssl with pow using stud

Instructions

  • Install stud $ brew install https://raw.github.com/paulnicholson/homebrew/master/Library/Formula/stud.rb
  • Download and install the powssl script $ curl https://gist.githubusercontent.com/paulnicholson/2050941/raw/7e4d2178e3733bed18fdfe737277c3cb72241d39/powssl > ~/bin/powssl $ chmod +x ~/bin/powssl
  • Run powssl to create development certificate and configure stud.
  • $ powssl
@twosixcode
twosixcode / gist:1988097
Created March 6, 2012 18:40
Make "Paste and Indent" the default paste in Sublime Text 2
// swap the keybindings for paste and paste_and_indent
{ "keys": ["super+v"], "command": "paste_and_indent" },
{ "keys": ["super+shift+v"], "command": "paste" }
@mattheworiordan
mattheworiordan / rate_limit.js
Created July 15, 2011 14:49
Rate limiting function calls with JavaScript and Underscore.js
/* Extend the Underscore object with the following methods */
// Rate limit ensures a function is never called more than every [rate]ms
// Unlike underscore's _.throttle function, function calls are queued so that
// requests are never lost and simply deferred until some other time
//
// Parameters
// * func - function to rate limit
// * rate - minimum time to wait between function calls
// * async - if async is true, we won't wait (rate) for the function to complete before queueing the next request
@gruber
gruber / gist:1063605
Created July 4, 2011 16:48
Simple Inbox Archiving Script for Apple Mail
-- See article here: http://daringfireball.net/2007/07/simple_inbox_sweeper
-- The following should be one long line:
set _description to "All unflagged, read messages in each IMAP account
inbox will be moved to the “Archive” mailbox corresponding to that
account. This action is not undoable."
tell application "Mail"
display alert "Archive read messages from IMAP inboxes?" buttons ¬
{"Cancel", "Archive"} cancel button 1 message _description