Attach this plugin to an input field and it matches the width of the field to the number of characters in the field. Great for inline editable text fields!
$('input').matchlength()
override func resignFirstResponder() -> Bool { | |
let resigned = super.resignFirstResponder() | |
self.layoutIfNeeded() | |
return resigned | |
} |
before_create :set_location | |
def set_location | |
factory = RGeo::Geographic.spherical_factory(srid: 4326) | |
self.lonlat = factory.point(lon, lat) | |
end |
default: &default | |
adapter: postgis | |
schema_search_path: '"$user", public, postgis' | |
production: | |
url: <%= ENV.fetch('DATABASE_URL', '').sub(/^postgres/, "postgis") %> |
RGeo::ActiveRecord::SpatialFactoryStore.instance.tap do |config| | |
# By default, use the GEOS implementation for spatial columns. | |
config.default = RGeo::Geos.factory_generator | |
# But use a geographic implementation for point columns. | |
config.register(RGeo::Geographic.spherical_factory(srid: 4326), geo_type: "point") | |
end |
web: bundle exec unicorn -p $PORT | |
worker: bundle exec sidekiq -q default | |
cron: bundle exec clockwork clock.rb |
<input type="file" name="file_selector" id="file_selector" multiple="multiple" accept="video/*"> |
var fileSelector = document.getElementById('file_selector') | |
var uploader = new FileUploader({ | |
uploadType: 'Video', | |
fileInput: fileSelector | |
}) |
friendly_id :slug_candidates, use: :slugged, slug_column: :namespace | |
def slug_candidates | |
[ | |
[:first_name, :last_name] | |
] | |
end | |
def normalize_friendly_id(value) | |
super.gsub(/\-/, '') |
.spinner { | |
margin: 100px auto; | |
width: 50px; | |
height: 30px; | |
text-align: center; | |
font-size: 10px; | |
opacity: .5; | |
} | |
.spinner > div { |