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
# | |
# Paperclip convert id => id_partition | |
# | |
require 'ftools' #FileUtils | |
class PaperclipExtend | |
def self.obtain_class | |
class_name = ENV['CLASS'] || ENV['class'] | |
uploads_path = ENV['UPLOADS_PATH'] || ENV['uploads_path'] | |
raise "Must specify CLASS" unless class_name |
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 Activo | |
module Rails | |
module Helper | |
# Displays a breadcrumb trail | |
# | |
# options - A hash of attributes to apply to the wrapping div tag | |
# | |
# Example: | |
# <div class="block"> |
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
#http://rcoder.net/content/testing-string-similarity-using-ruby-and-zlib | |
#see also: http://www.postgresql.org/docs/8.3/static/fuzzystrmatch.html | |
#see also: http://flori.github.com/amatch/ | |
require 'zlib' | |
# this is optimized to store a relatively smaller subset of common index | |
# terms against which new strings should be tested | |
class ZlibDistanceCalc | |
def initialize |
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
#/usr/local/elasticsearch/elasticsearch-0.17.7/logger.yml/elasticsearch.yml | |
# The cluster name | |
cluster.name: traceful_elasticsearch | |
cloud: | |
aws: | |
access_key: AKIAIPILOGJA7ORIBDNQ | |
secret_key: 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 |
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
<% count = 1 %> | |
<% if @invoice.lines.subscriptions.any? %> | |
<% @invoice.lines.subscriptions.each do |subscription| -%> | |
<tr class="<%= count % 2 == 0 ? 'even' : 'odd' %>"> | |
<td class="first"><%= format_unix_time(subscription.period.end) %></td> | |
<td><%= subscription.plan.name %> subscription from <%= format_unix_time(subscription.period.start) %> to <%= format_unix_time(subscription.period.end) %></td> | |
<td><%= number_to_currency(subscription.amount/100) %></td> | |
</tr> | |
<% count += 1 %> | |
<% 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
jQuery.validator.addMethod("phoneUS", function(phone_number, element) { | |
phone_number = phone_number.replace(/\s+/g, ""); | |
return this.optional(element) || phone_number.length > 9 && | |
phone_number.match(/^(1-?)?(\([2-9]\d{2}\)|[2-9]\d{2})-?[2-9]\d{2}-?\d{4}$/); | |
}, "Please specify a valid phone number"); | |
// Source: http://docs.jquery.com/Plugins/Validation/CustomMethods/phoneUS |
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
<style> | |
.contentWrap{float:left;width:630px;} | |
.formRow{float:right;position:releative;} | |
.wrapper.site_wrapper .salsa FORM .supporterInfo{float:right;margin:0;padding:0 0 0 30px;position:relative;height:auto;top:-40px !important} | |
.wrapper.site_wrapper .salsa FORM .supporterInfo SELECT{padding:8px;width:203px;} | |
.formRow INPUT.blockInput{padding:8px;} | |
.wrapper.site_wrapper .salsa FORM{position:relative;overflow:hidden;} |
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 action="http://anotherdomain/save" method="post" target="myiframe" id="myform"> | |
<!-- standard form here --> | |
</form> | |
<iframe src="about:blank" name="myiframe" style="display: none;"></iframe> | |
<!-- Then, javascript something like: --> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script> | |
<script> |
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 'tire' | |
require 'sqlite3' | |
require 'active_record' | |
ActiveRecord::Base.establish_connection( adapter: 'sqlite3', database: ":memory:" ) | |
ActiveRecord::Migration.verbose = false | |
ActiveRecord::Schema.define(version: 1) do | |
create_table :articles do |t| | |
t.string :title |
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
textarea.markItUpEditor { | |
height: 500px; | |
min-height: 600px; | |
padding: 2px; | |
} | |
#activeUser { | |
margin-top: 0; | |
padding-top: 0; | |
} |
OlderNewer