This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; UTF-8 | |
(require 'un-define "un-define" t) | |
(set-buffer-file-coding-system 'utf-8 'utf-8-unix) | |
(set-default buffer-file-coding-system 'utf-8-unix) | |
(set-default-coding-systems 'utf-8-unix) | |
(prefer-coding-system 'utf-8-unix) | |
(set-default default-buffer-file-coding-system 'utf-8-unix) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def path_to_attachment_image(attachment) | |
image_path("attachments/#{attachment.filename}") | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'active_support' | |
# Turns | |
# c('title LIKE ', "%#{query}%", ' AND published = ', true) | |
# into | |
# ['title LIKE ? AND published = ?', "%#{query}%", true] | |
# | |
# In other words, ladies and mentlegen, you can now do a find as such: | |
# find(:all, :conditions => c('gender =', params[:gender], 'AND published =', true)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pun = Httpun.get('http://google.com/') | |
case pun.status | |
when 400..403 | |
# uh.. yeah | |
when 404 | |
# indeed | |
else | |
# yep | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 'mySlideshow' will always have the size of the movie clip. Even if it's being resized in a browser window (thanks to the scaleMode) | |
stage.align = StageAlign.TOP_LEFT | |
stage.scaleMode = StageScaleMode.NO_SCALE | |
var resizeHandler = function(e){ | |
var stageWidth:Number = Math.round(mySlideshow.stage.stageWidth) | |
var stageHeight:Number = Math.round(mySlideshow.stage.stageHeight) | |
mySlideshow.width = stageWidth; | |
mySlideshow.height = stageHeight; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function($){ | |
function Calendar(dayRenderFunc, options){ | |
this.dayRenderFunc = dayRenderFunc | |
this.settings = $.extend({ | |
month: new Date(), | |
firstDayOfWeek: 0, | |
tableAttributes: { | |
"class": 'calendar' | |
} | |
}, options) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function($){ | |
$.fn.inlineLabels = function(options){ | |
var self = this; // scope.. | |
this.labelElements = this.find("input:text, textarea") | |
var settings = $.extend({ | |
suffix: '...' | |
}, options) | |
this.labelElements.each(function(i, input){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Twitter Hashtag Ignore | |
// version 0.3 | |
// 2008-01-25 | |
// Copyright (c) 2009, August Lilleaas | |
// Released under the MIT license | |
// http://www.opensource.org/licenses/mit-license.php | |
// | |
// ==UserScript== | |
// @name Twitter Hashtag Ignore | |
// @namespace http://www.twitter.com/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Include all the files in lib/core_ext | |
Dir.glob(File.join(Rails.root, 'lib', 'core_ext', '*.rb')).each do |core_ext| | |
require core_ext | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Remove some files we don't need. | |
%w(public/javascripts/* public/index.html public/images/rails.png).each do |path_spec| | |
run "rm #{path_spec}" | |
end | |
# jQuery! | |
run "curl http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js > public/javascripts/jquery.js" | |
file "public/javascripts/application.js" | |
# Create app/views/layouts/application.html.erb |