Skip to content

Instantly share code, notes, and snippets.

en.versions.each{|v| print v.event; print "\n";print v.object_changes;print "---------------------------\n"}
pg_dump --encoding=utf8 --no-owner --username username --format plain --verbose --table public.table_name db_name --file "filename"
psql --username=username db_name -f filename
git ls-files -ci —exclude-standard -z | xargs -0 git rm —cached
{
// Place your snippets for javascript here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
"Redux Axios action": {
"description": "Create axios action",
"prefix": "axios_action",
"body": [
def self.enquiry_created(enquiry)
tries ||= 3
params = default_params(enquiry).merge(enq: 1, pax: 1)
Pusher.trigger('enquiry_report', 'data_updated', params)
rescue Pusher::HTTPError, HTTPClient::ConnectTimeoutError => e
retry if (tries -= 1) > 0
end
@StaverDmitry
StaverDmitry / .js
Last active November 19, 2017 19:14
function recusion(token, folder) { // не id а саму папку, чтобы можно был один интерфейс
subfolders = [];
var folders = getSubfolders(token, folder.id)
for (var i = 0; i < folders.items.length; i++) {
subfolders.push(recusion(token, folders[i]));
}
folder['subfolders'] = subfolders;
return folder
}
cancellation_fees_params.map do |c_f_params|
fee = CancellationFee.find_or_initialize_by(cancellable_id: c_f_params[:cancellable_id],
cancellable_type: c_f_params[:cancellable_type])
fee.assign_attributes(c_f_params)
fee.save
fee
end
def update
respond_to do |format|
if @enquiry.update(enquiry_params)
cust = @enquiry.customer
cust.title=params[:enquiry][:customer][:title] if params[:enquiry][:customer][:title].present?
cust.first_name=params[:enquiry][:customer][:first_name] if params[:enquiry][:customer][:first_name].present?
cust.last_name=params[:enquiry][:customer][:last_name] if params[:enquiry][:customer][:last_name].present?
cust.address=params[:enquiry][:customer][:address] if params[:enquiry][:customer][:address].present?
cust.age=params[:enquiry][:customer][:age] if params[:enquiry][:customer][:age].present?
cust.nationality=params[:enquiry][:customer][:nationality] if params[:enquiry][:customer][:nationality].present?
- 4
- 8h fixing tour's import (TOURS IMPORT)
- 1h (investigating missing Representatives)
- 5
- 3h added the new search option, refactored API (add search by a boat for api)
- 2h (fixing empty cells in the enquiry report)
- 3h (add bcc to all outgoing emails)
- 6
- 3h deploy and test some tasks with Justin, some work with payments (manage and check)
- 2h investigate and find a new js lib for the button (fix copy button)
def extras_total
@extras_total ||= extras.reject(&:_destroy).sum(&:amount)
end