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.
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
@app = angular.module 'myApp', [] | |
@app.filter "nrFormat", -> | |
(number) -> | |
if number!=undefined | |
console.log number | |
abs = Math.abs(number) | |
if abs >= Math.pow(10, 12) | |
# trillion | |
number = (number / Math.pow(10, 12)).toFixed(1)+"t" | |
else if abs < Math.pow(10, 12) and abs >= Math.pow(10, 9) |
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
# 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 |
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
namespace :searchkick do | |
desc "maybe reindex without running out of memory?" | |
task :altindex, [:start_index, :batch_size, :new_index_name] => :environment do |t, args| | |
ActiveRecord::Base.logger = Logger.new(STDOUT) | |
count = Item.count | |
start = args[:start_index].to_i || 0 | |
batch_size = args[:batch_size].to_i || 1000 | |
# we create a new index or take one already present | |
if args[:new_index_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
# Some interesting python script: | |
# https://raw.githubusercontent.com/adafruit/PiTFT_Extras/master/pitft_touch_cal.py | |
# > sudo add-apt-repository ppa:tias/xinput-calibrator-ppa | |
> sudo apt-get update && sudo apt-get install xinput-calibrator | |
> apt-get install xinput | |
> export DISPLAY=:0.0 | |
> xinput list-props "EloTouchSystems,Inc Elo TouchSystems 2216 AccuTouch® USB Touchmonitor Interface" | |
> xinput set-prop "EloTouchSystems,Inc Elo TouchSystems 2216 AccuTouch® USB Touchmonitor Interface" "Evdev Axis Inversion" 0 1 | |
# here touch the points on the screen in the corners | |
> xinput_calibrator --output-type xinput |
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
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 |
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
# 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)) |
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:
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>
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
# FOR BUSY JOBS | |
# take the process_id from the /busy page in sidekiq and kill the longest running one. | |
workers = Sidekiq::Workers.new | |
long_process_id = 'integration.3:4:71111aaa111' # Eg: 'integration.3:4:71d1d7f4ef5a' | |
workers.each do |process_id, thread_id, work| | |
process = Sidekiq::Process.new('identity' => process_id) | |
process.stop! if process_id == long_process_id | |
end | |
# FOR SCHEDULED JOBS |
OlderNewer