For master branch of rails/rails (http://edgeguides.rubyonrails.org/active_storage_overview.html#downloading-files):
message.video.open do |file|
system '/path/to/virus/scanner', file.path
# ...
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
git branch | grep -v "master\|develop" | xargs git branch -D |
####################################################################################
- You have two full days to implement a solution
- You can use any (fairly) mainstream object oriented language of your choice, so long as your solution builds and runs on linux. You should be fine if you favour, say, Java, Ruby, Python or Javascript.
- Please ensure that you follow the syntax and formatting of both the
This brief guide is written from my own experience with migrating a large (~5GB) MySQL database to PostgreSQL for a Rails project.
No warranties, guarantees, support etc. Use at your own risk and, as always, ENSURE YOU MAKE BACKUPS FIRST!
I chose [pgloader
][1] because it's extremely fast. YMMV.
- Replace
mysql2
gem withpg
inGemfile
. - Update
config/database.yml
for PostgreSQL. I used [Rails' template][2] as a starting point.
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
$(document).on('page:change', function() { | |
var $productContainer = $('#product-container'); | |
if ($productContainer.length) { | |
setInterval(fetchProducts, 500); | |
} | |
function fetchProduct() { | |
// some ajax code | |
} |
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
import code; code.interact(local=dict(globals(), **locals())) |
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
[alias] | |
co = checkout | |
cob = checkout -b | |
coo = !git fetch && git checkout | |
br = branch | |
brd = branch -d | |
brD = branch -D | |
merged = branch --merged | |
st = status | |
aa = add -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
HTTP status code symbols for Rails | |
Thanks to Cody Fauser for this list of HTTP responce codes and their Ruby on Rails symbol mappings. | |
Status Code Symbol | |
1xx Informational | |
100 :continue | |
101 :switching_protocols | |
102 :processing |
NewerOlder