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
| .modal-backdrop { | |
| background: #000; | |
| background: rgba(0,0,0,0.9); | |
| background: -webkit-radial-gradient(50% 50%, ellipse closest-corner, rgba(0,0,0,0.45) 1%, rgba(0,0,0,0.8) 100%); | |
| background: -moz-radial-gradient(50% 50%, ellipse closest-corner, rgba(0,0,0,0.45) 1%, rgba(0,0,0,0.8) 100%); | |
| background: -ms-radial-gradient(50% 50%, ellipse closest-corner, rgba(0,0,0,0.45) 1%, rgba(0,0,0,0.8) 100%); | |
| background: radial-gradient(50% 50%, ellipse closest-corner, rgba(0,0,0,0.45) 1%, rgba(0,0,0,0.8) 100%); | |
| filter: alpha(opacity = 80); | |
| opacity: 0; |
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
| <!-- Sync script will block rendering of page --> | |
| <script type="text/javascript" src="http://link-to-js-assets.js"></script> | |
| <!-- Async script will not block rendering = Preferred Method --> | |
| <script type="text/javascript"> | |
| (function() { | |
| var po = document.createElement('script'); po.type = 'text/javascript'; | |
| po.async = true; po.src = 'http://link-to-js-assets.js'; | |
| var s = document.getElementsByTagName('script')[0]; | |
| s.parentNode.insertBefore(po, s); |
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
| cd ~ | |
| sudo apt-get update | |
| sudo apt-get install openjdk-7-jre -y | |
| wget https://github.com/downloads/elasticsearch/elasticsearch/elasticsearch-0.19.11.tar.gz -O elasticsearch.tar.gz | |
| tar -xf elasticsearch.tar.gz | |
| rm elasticsearch.tar.gz | |
| sudo mv elasticsearch-* elasticsearch | |
| sudo mv elasticsearch /usr/local/share |
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
| require 'clockwork' | |
| require 'sidekiq' | |
| # load all jobs from app/jobs directory | |
| # no need to load rails env, we only care about classes | |
| # (#perform method is not invoked in this process) | |
| Dir["app/jobs/*"].each {|f| load f } | |
| module Clockwork | |
| every(1.day, 'midnight.job', :at => '00:00'){ |
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
| #import <RestKit/RestKit.h> | |
| #import "CoreData+MagicalRecord.h" | |
| // Use a class extension to expose access to MagicalRecord's private setter methods | |
| @interface NSManagedObjectContext () | |
| + (void)MR_setRootSavingContext:(NSManagedObjectContext *)context; | |
| + (void)MR_setDefaultContext:(NSManagedObjectContext *)moc; | |
| @end | |
| @implementation AppDelegate |
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
| # http://matthewhutchinson.net/2010/10/27/rails-3-subdomain-validation-activemodeleachvalidator | |
| # subdomain_validator.rb (place in your lib/ or extra/ load path) | |
| class SubdomainValidator < ActiveModel::EachValidator | |
| def validate_each(object, attribute, value) | |
| return unless value.present? | |
| reserved_names = %w(www ftp mail pop smtp admin ssl sftp) | |
| reserved_names = options[:reserved] if options[:reserved] | |
| if reserved_names.include?(value) | |
| object.errors[attribute] << 'cannot be a reserved name' |
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 render_erb(template_path, params) | |
| view = ActionView::Base.new(ActionController::Base.view_paths, {}) | |
| class << view | |
| include ApplicationHelper | |
| end | |
| view.render(:file => "#{template_path}.html.erb", :object => params) | |
| end |
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
| RAILS_ENV=production rake db:setup | |
| # produces the error below.....hmmm.....it's a no-worky | |
| psql:/yourprojectpath/yourproject/db/structure.sql:29: ERROR: could not open extension control file "/usr/share/postgresql/9.1/extension/hstore.control": No such file or directory | |
| # hstore postgresql extension needs to be installed, so.... | |
| sudo apt-get install postgresql-contrib | |
| # now your extension should be available to enable so log in with psql | |
| psql -d yourproject_production -U yourdbuser -W |
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
| <% [:notice, :error, :alert].each do |level| %> | |
| <% unless flash[level].blank? %> | |
| <div class="alert <%= flash_class(level) %>"> | |
| <a class="close" href="#">×</a> | |
| <%= content_tag :p, flash[level] %> | |
| </div> | |
| <% end %> | |
| <% end %> |