Skip to content

Instantly share code, notes, and snippets.

View Print versions
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
View git remove ignored cached files
git ls-files -ci —exclude-standard -z | xargs -0 git rm —cached
View gist:8e83caebc79bd0e49dd8d544bbb868b9
// 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": [
View .rb
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
View .js
function recusion(token, folder) { // не id а саму папку, чтобы можно был один интерфейс
subfolders = [];
var folders = getSubfolders(token,
for (var i = 0; i < folders.items.length; i++) {
subfolders.push(recusion(token, folders[i]));
folder['subfolders'] = subfolders;
return folder
View create_cancellation_fees_service.rb do |c_f_params|
fee = CancellationFee.find_or_initialize_by(cancellable_id: c_f_params[:cancellable_id],
cancellable_type: c_f_params[:cancellable_type])
View bookings_controller.rb
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?
View time_log
- 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)
View enquiry.rb
def extras_total
@extras_total ||= extras.reject(&:_destroy).sum(&:amount)