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
| // Deleting a parent when you have `dependent: :destroy` on the server | |
| // given `parent` a parent record | |
| // `children` the parent's children | |
| var childrenTransaction, parentTransaction; | |
| childrenTransaction = this.get('store').transaction(); | |
| childrenTransaction.add(parent); | |
| parent.deleteRecord(); | |
| parentTransaction.add(parent); |
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
| curl -XDELETE "localhost:9200/test" | |
| curl -XPUT "localhost:9200/test" -d '{ | |
| "mappings": { | |
| "doc": { | |
| "properties": { | |
| "price": { | |
| "type": "long" | |
| }, | |
| "colour": { | |
| "type": "string", |
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 'date' | |
| require 'benchmark' | |
| n = 1_000_000 | |
| start_date = Date.new(2012, 01, 01) | |
| end_date = Date.new(2012, 03, 01) | |
| act_date = Date.new(2012, 02, 01) | |
| Benchmark.bm(10) do |x| | |
| x.report('include?') do |
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
| # Gemfile | |
| gem "puma" | |
| # Procfile | |
| web: bundle exec puma -p $PORT -e $RACK_ENV -C config/puma.rb | |
| # add to config block config/environments/production.rb | |
| config.threadsafe! | |
| # get rid of NewRelic after_fork code, if you were doing this: |
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
| <% flash.each do |type, message| %> | |
| <div class="alert <%= bootstrap_class_for(type) %> fade in"> | |
| <button class="close" data-dismiss="alert">×</button> | |
| <%= message %> | |
| </div> | |
| <% 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
| unicorn.rb | |
| ----------------------------------- | |
| application = "jarvis" | |
| remote_user = "vagrant" | |
| env = ENV["RAILS_ENV"] || "development" | |
| RAILS_ROOT = File.join("/home", remote_user, application) | |
| worker_processes 8 | |
| timeout 30 |
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
| class PostsController < ActionController::Base | |
| def create | |
| Post.create(post_params) | |
| end | |
| def update | |
| Post.find(params[:id]).update_attributes!(post_params) | |
| end | |
| private |
NewerOlder

