Skip to content

Instantly share code, notes, and snippets.

View danott's full-sized avatar
📈
Chart with upward trend

Dan Ott danott

📈
Chart with upward trend
View GitHub Profile
@danott
danott / gist_embed.coffee
Created November 30, 2011 06:28
Embed GitHub Gists without blocking the page.
# Asynchronously load GitHub Embeds
# Why?
# Because no web developer worth his weight in bacon salt wants to have blocking <script /> style embeds in his content.
# I want to be able to link to GitHub gists I write, and I want those links to show up in content aggregators as well.
# And then, if possibly, progressively enhance by embedding the gist.
#
# Usage, simply link to a gist. An entire gist, or an anchor tag to a particular file.
#
# Requires: jQuery and Modernizr
#
@danott
danott / history.sh
Created November 30, 2011 18:03
Terminal Log
$ git branch -l
master
* operation_righteous_cowboy_lightning
@danott
danott / make_grid.rb
Created December 2, 2011 00:06
Really rough go at custom fluid grid systems
# Make Grid
# Only creates elements relative to that container.
# things to include elsewhere = .alpha, .omega, .grid_right
grid_width = 15
temp =<<CSS
/* Containers
-------------*/
@danott
danott / boilerplate.rb
Created December 16, 2011 23:06
Ruby Command Line Utility Boilerplate
#!/usr/local/bin/ruby
puts "Running application"
class App
def initialize(args)
end
def action(input)
"input was #{input}"
@danott
danott / open_in_dev.js
Created February 7, 2012 01:01
Open the Current site with a .dev extension. Works with a pow setup.
javascript:window.open(window.location.href.replace(/\.(com|org|net|tv|cc|us)/,".dev"))
@danott
danott / rdebug-pow.rb
Created February 7, 2012 18:12 — forked from jkronz/rdebug-pow.rb
rdebug using pow
# config/initializers/danott_custom.rb
# connect using rdebug -c
if (Rails.env.development? || Rails.env.test?) && !$rails_rake_task
require 'ruby-debug'
Debugger.settings[:autoeval] = true
Debugger.settings[:autolist] = 1
Debugger.settings[:reload_source_on_change] = true
Debugger.start_remote
end
@danott
danott / pad_word_list.php
Created February 15, 2012 05:43
Array of Words, padding using a random string generator (8 characters)
<?php
public static function padWordlist($wordlistArr,$padTo){
$pads = $padTo-count($wordlistArr);
for($i=0;$i<$pads;$i++){
$wordlistArr[] = self::getTail(8);
}
return $wordlistArr;
}
?>
@danott
danott / facebook-tinymce.js
Created March 7, 2012 21:34 — forked from cheeaun/facebook-tinymce.js
Facebook's TinyMCE code
function MceEditor() {}
MceEditor.prototype = {
init: function (b, c) {
this.canvasId = b.id;
this.settings = c;
var a = c.plugins;
if (a && a.search('AtD') !== -1) this.settings.atd_rpc_id = $('post_form_id').value;
if (this.is_visible || !this.settings.delay_initialization) this.startEditor();
},
startEditor: function () {
@danott
danott / async_gists.coffee
Created March 11, 2012 06:21
Embed GitHub Gists asynchronously.
# Asynchronously load GitHub Embeds
# Why?
# Because no web developer worth his weight in bacon salt wants to have blocking <script /> style embeds in his content.
# I want to be able to link to GitHub gists I write, and I want those links to show up in content aggregators as well.
# And then, if possible, progressively enhance by embedding the gist.
#
# Usage, simply link to a gist. An entire gist, or an anchor tag to a particular file.
#
# Requires: jQuery and Modernizr
#
@danott
danott / auto_markup.rb
Created March 20, 2012 21:10
An idea for automatically generating markup in rails... Needs refinement
##
# CSS NAMING CONVENTIONS!
#
# A Model CheeseBurger has a number of existing conventions in rails
# Table name: cheese_burgers
# Views: app/views/cheese_burgers/
# Collection partial: app/views/cheese_burgers/_cheese_burger.html.erb
#
# IDEA: Let a naming convention flow down into the css markup.
# Inspired after reading http://nicolasgallagher.com/about-html-semantics-front-end-architecture/