This file contains hidden or 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
ree-1.8.7-2011.03 :002 > Array("aa\nbb") | |
=> ["aan", "bb"] | |
ruby-1.9.2-p180 :008 > Array("aa\nbb") | |
=> ["aanbb"] |
This file contains hidden or 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
[alias] | |
co = checkout | |
br = branch | |
mav = !afplay -v .3 -t 12 '/Users/jdwyah/Music/iTunes/iTunes Music/Kenny Loggins/Top Gun/Danger Zone.mp3' &\ngit rebase -i | |
panic = !tar cvf ../git_panic.tar * |
This file contains hidden or 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
# MavMark v 0.1 | |
######################### | |
# Indent a messed up ruby file. | |
# Goal: | |
#def excluded_description | |
# excludes_that_exist = @report.excludes.inject({}) do |memo, (dim,excludes)| | |
# swap_unrep = (@report.original_dim_labels[dim.to_sym] || []).map{|l| l.blank? ? 'Unreported' : l} | |
# memo[dim] = excludes & swap_unrep | |
# memo |
This file contains hidden or 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
pg_restore: [archiver (db)] could not execute query: ERROR: must be member of role "postgres" | |
Command was: ALTER SCHEMA multum OWNER TO postgres; | |
pg_restore: [archiver (db)] Error from TOC entry 1217; 2612 200456859 PROCEDURAL LANGUAGE plpgsql postgres | |
pg_restore: [archiver (db)] could not execute query: ERROR: must be owner of database plmwebsite | |
Command was: CREATE PROCEDURAL LANGUAGE plpgsql; | |
pg_restore: [archiver (db)] could not execute query: ERROR: language "plpgsql" does not exist | |
Command was: ALTER PROCEDURAL LANGUAGE plpgsql OWNER TO postgres; | |
pg_restore: [archiver (db)] Error from TOC entry 21; 1255 422525031 FUNCTION _group_concat(text, text) postgres | |
pg_restore: [archiver (db)] could not execute query: ERROR: must be member of role "postgres" | |
Command was: ALTER FUNCTION public._group_concat(text, text) OWNER TO postgres; |
This file contains hidden or 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
# our multi_group http://rails.lighthouseapp.com/projects/8994/tickets/120-patch-activerecord-calculations-only-accept-one-grouping-field# | |
# isn't updated for 2.2 yet. In the meantime, this poor man's version gives you the same results with some delimitter tom foolery. | |
# | |
# note: be careful to ensure that your group_by do not use the delimitter | |
# usage: | |
# self.multi_count(:id, :distinct => true, :group => [:symptom_id, :treatment_id]) | |
# [[["138", "1018"], 187], [["138", "427"], 373], [["6", "1018"], 197], [["6", "427"], 393]] | |
class ActiveRecord::Base | |
def self.multi_count(field, opts = {}) | |
fq_field_name = "#{table_name}.#{field}" |
This file contains hidden or 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 encrypt(string, key) | |
Base64.encode64(aes(key, string)).gsub /\s/, '' | |
end | |
def decrypt(string, key) | |
aes_decrypt(key, Base64.decode64(string)) | |
end | |
def aes(key,string) | |
cipher = OpenSSL::Cipher::Cipher.new("aes-256-cbc") |
This file contains hidden or 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
Ajax.Responders.register({ | |
onCreate: function(a) { | |
if(a.method != 'get'){ | |
a['parameters']['authenticity_token'] = encodeURIComponent('#{form_authenticity_token}'); | |
} | |
} | |
}); |
NewerOlder