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
module ActiveSupport | |
module Inflector | |
alias :old_foreign_key :foreign_key | |
def foreign_key(class_name, separate_class_name_and_id_with_underscore = true) | |
old_foreign_key(class_name, false) | |
end | |
def tableize(class_name) | |
class_name | |
end | |
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
<configSections> | |
<section name="nhaml" type="NHaml.Configuration.NHamlConfigurationSection, NHaml"/> | |
</configSections> | |
<nhaml templateCompiler="CSharp4" useTabs="true"> | |
<assemblies> | |
<add assembly="System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/> | |
<add assembly="Microsoft.CSharp, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/> | |
</assemblies> | |
</nhaml> |
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 'sinatra/base' | |
require 'haml' | |
require 'models' | |
require 'rack-flash' | |
require 'pony' | |
require 'mime/types' | |
class App < Sinatra::Base | |
enable :sessions |
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
recipe Running jQuery recipe... | |
/usr/lib/ruby/1.8/open-uri.rb:174:in `open_loop': redirection forbidden: http://github.com/rails/jquery-ujs/raw/master/src/rails.js -> https://github.com/rails/jquery-ujs/raw/master/src/rails.js (RuntimeError) | |
from /usr/lib/ruby/1.8/open-uri.rb:132:in `open_uri' | |
from /usr/lib/ruby/1.8/open-uri.rb:518:in `open' | |
from /usr/lib/ruby/1.8/open-uri.rb:30:in `open' | |
from /usr/lib/ruby/gems/1.8/gems/thor-0.14.3/lib/thor/actions/file_manipulation.rb:55:in `get' | |
from http://railswizard.org/f866948c3a033b907ff4.rb:79:in `apply' | |
from /usr/lib/ruby/gems/1.8/gems/thor-0.14.3/lib/thor/actions.rb:167:in | |
`inside' | |
from /usr/lib/ruby/1.8/fileutils.rb:121:in `chdir' |
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 :environment do | |
DataMapper.setup(:default, ENV['DATABASE_URL']) | |
AWS::S3::Base.establish_connection!( | |
:access_key_id => ENV['AMAZON_ACCESS_KEY_ID'], | |
:secret_access_key => ENV['AMAZON_SECRET_ACCESS_KEY']) | |
uri = URI.parse(ENV["REDISTOGO_URL"]) | |
Resque.redis = Redis.new(:host => uri.host, :port => uri.port, :password => uri.password) | |
Pony.options = { | |
:via => :smtp, | |
:via_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
class AesCryptoProvider : ICryptoProvider | |
{ | |
private string password; | |
public AesCryptoProvider(string password) | |
{ | |
this.password = password; | |
} | |
public byte[] Encrypt(string inputText) |
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
public class EncryptedColumnInEntity : Entity | |
{ | |
protected virtual byte[] EncryptedText { get; set; } | |
/// <summary> | |
/// Decryptes the text stored in the database | |
/// </summary> | |
/// <exception cref="CryptographicException">Throws CryptographicException when the password isn't valid</exception> | |
/// <param name="password">The password which the text was encrypted with</param> | |
/// <returns>Decrypted text</returns> |
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
public class MonoWebFormViewEngine : WebFormViewEngine | |
{ | |
protected override bool FileExists(ControllerContext controllerContext, string virtualPath) | |
{ | |
return base.FileExists(controllerContext, virtualPath.Replace("~", "")); | |
} | |
} | |
public class MonoRazorViewEngine : RazorViewEngine | |
{ |
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
protected void Application_Error(object sender, EventArgs e) | |
{ | |
var error = Server.GetLastError(); | |
var log = LogManager.GetLogger(GetType()); | |
var msg = string.Format("\r\nPath: {0}\r\nMethod: {4}\r\nUser: {1}\r\nForm: {2}\r\nReferer: {3}", | |
Request.Url, | |
User.Identity.Name, | |
Request.Form, | |
Request.UrlReferrer, | |
Request.HttpMethod); |
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
public class AutocompleteController : Controller | |
{ | |
private readonly IRepository db; | |
public AutocompleteController(IRepository db) | |
{ | |
this.db = db; | |
} | |
public JsonResult Users(string term) | |
{ |