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
" begin script to prevent pase over from replacing the default register | |
" contents | |
function! RestoreRegister() | |
let @" = s:restore_reg | |
return '' | |
endfunction | |
function! s:Repl() | |
let s:restore_reg = @" | |
return "p@=RestoreRegister()\<cr>" |
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
task :cron => :environment do | |
@config = YAML.load_file("#{RAILS_ROOT}/config/helpdesk.yml") | |
@config = @config["EMAIL"]["incoming"][RAILS_ENV].to_options | |
@fetcher = Fetcher.create({:receiver => Helpdesk::TicketNotifier}.merge(@config)) | |
@fetcher.fetch | |
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 'cairo' | |
require 'rubygems' | |
require 'ruby-debug' | |
def warp_path(context, &block) | |
first = true | |
context.copy_path.each do |type, points| | |
case type |
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
$("#uploadify").uploadify({ | |
// Eval the response | |
'onComplete' : function(a, b, c, response){ eval(response) }, | |
// And set the accept header to application/javascript | |
'scriptData' : { | |
'<%%= session_key_name %>' : '<$%= u cookies[session_key_name] %>', | |
'_http_accept': "application/javascript" | |
}, |
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
# swatches.yml | |
black: "#0F0F0F" | |
blue: "#3055A0" | |
gray: "#949A9F" | |
green: "#4D8756" | |
light_green: "#92C14F" | |
navy: "#304264" | |
orange: "#DA7A2D" | |
red: "#C31E38" | |
teal: "#477D79" |
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
# | |
# You can also do Job.solr_search, but I like this syntax better | |
# | |
Sunspot.search(Job) do | |
with(:specializations, ['rails', 'python', 'perl') | |
end.results |
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
$("#google-voice").submit(function(e){ | |
e.preventDefault(); | |
$.post("/phone_calls", $(this).serialize(), function(data){ | |
if(data=="ok=true"){ | |
console.log("success"); | |
} | |
else{ | |
console.log("failure"); |
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 'rack/utils' | |
class FlashSessionCookieMiddleware | |
def initialize(app, session_key = '_session_id') | |
@app = app | |
@session_key = session_key | |
end | |
def call(env) | |
if env['HTTP_USER_AGENT'] =~ /^(Adobe|Shockwave) Flash/ |
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
<% form_for Job.new do |f| %> | |
# | |
# Here, we use a multiple select, but any forrm element named | |
# "job_specializations[]" will populate the jobs.specializations | |
# array | |
# | |
<%= f.select :specializations, | |
["rails", "ruby", "js", "python], | |
:multiple => 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
# app/models/job.rb | |
class Job | |
# job.specializations will hold an array of strings | |
# like this: ['rails', 'javascript'] | |
serialize :specializations, Array | |
# Solr will index each element of the array separately | |
searchable do |
OlderNewer