I hereby claim:
- I am chocksy on github.
- I am chocksy (https://keybase.io/chocksy) on keybase.
- I have a public key ASBvEeMzFwcVcTJuReETgNhjWE-ZwPxiU5Nl0hd1ewS8Two
To claim this, I am signing this object:
| # Taken from a rails app using mongoid and activrecord at the same time. | |
| def transfer_mongo_to_sql(collection_name, fields=[]) | |
| ic = Mongoid.default_session.collections.select { |c| c.name==collection_name }.first | |
| total_items = ic.find.count | |
| per_batch = 1000 | |
| 0.step(total_items, per_batch) do |offset| | |
| to_fields = fields.map { |c| c[:to_name] }.join(', ') | |
| insert_raw_sql = "INSERT INTO #{collection_name} (#{to_fields}) VALUES " | |
| before = Time.now |
| it 'tracks and event', verify_partial_doubles: false do | |
| expect_any_instance_of(Analytics).to receive(:track) do |_o, options| | |
| expect(options).to include(event: 'invited user') | |
| expect(options[:properties]).to include(organization: organization.name) | |
| end | |
| post_with owner, :create_invites, params | |
| end |
I hereby claim:
To claim this, I am signing this object:
| # use this file in the rails app root directory and run it with | |
| # ruby precompile_assets.rb to see if there is any error in your | |
| # js file assets by using Uglifier. This would save you from running | |
| # rake assets:precompile and using production as env var. | |
| require './config/environment' | |
| JS_PATH = 'app/assets/javascripts/**/*.js'.freeze | |
| Dir[JS_PATH].each do |file_name| | |
| puts "\n#{file_name}" | |
| puts Uglifier.compile(File.read(file_name)) |
| module ActiveRecordPluckToHash | |
| def pluck_to_hash(*keys) | |
| formatted_keys = keys.map do |k| | |
| "'#{k.to_s.split(/\b.\b/i)[-1].strip}', #{k}" | |
| end.join(', ') | |
| pluck(Arel.sql("json_build_object(#{formatted_keys})")).map(&:with_indifferent_access) | |
| end | |
| end |
Check out these https://portswigger.net/web-security/cross-site-scripting/cheat-sheet
This is a regular paragraph.
<script>alert('xss');</script>
This is another regular paragraph.
hello <a href="www.google.com">*you*</a>
| /** | |
| * Retrieves all the rows in the active spreadsheet that contain data and logs the | |
| * values for each row. | |
| * For more information on using the Spreadsheet API, see | |
| * https://developers.google.com/apps-script/service_spreadsheet | |
| */ | |
| function readRows() { | |
| var sheet = SpreadsheetApp.getActiveSheet(); | |
| var rows = sheet.getDataRange(); | |
| var numRows = rows.getNumRows(); |
| # custom RubyMine properties | |
| editor.zero.latency.typing=true |
wp_posts, wp_postmeta tables from the old DB.wp_old_posts, wp_old_postmeta into the new DB.utf8mb4_unicode_ci to utf8mb4_unicode_520_ciwp_posts)INSERT INTO wp_posts (old_id, post_author, post_date, post_date_gmt, post_content, post_title, post_excerpt, post_status, comment_status, ping_status, post_password, post_name, to_ping, pinged, post_modified, post_modified_gmt, post_content_filtered, post_parent, guid, menu_order, post_type, post_mime_type, comment_count)
SELECT * FROM wp_old_posts;The solution for the above problem is to have a different gemfile that you run your rails app against. It can be easily done by adding some terminal aliases to use a different gemfile file. I made that in the current configuration and it works well.