Skip to content

Instantly share code, notes, and snippets.

View dawidof's full-sized avatar

Dmytro Koval dawidof

View GitHub Profile
module Responder
class Broadcast < ActiveRecord::Base
has_many :broadcast_actions
has_many :sent_messages, as: :supplier
has_many :sms_sents, as: :supplier
has_many :subscriber_list_items, as: :item
has_many :subscriber_lists, through: :subscriber_list_items
validates :name, presence: true, uniqueness: true
=simple_form_for @inbox_sent, url: compose_send_inboxes_path, method: :post, html: {id: 'fileupload', class: 'inbox-compose form-horizontal', multipart: true} do |f|
.inbox-compose-btn
=button_tag id: 'send_message', class: 'btn blue'
i.fa.fa-check
| Send
=button_tag "Cancel", id: 'discard_changes', class: 'btn'
=button_tag "Draft", id: 'save_draft', class: 'btn'
.inbox-form-group.mail-to
= f.input :to, wrapper: false do
@dawidof
dawidof / osx-10.11-setup.md
Created March 17, 2016 23:12 — forked from kevinelliott/osx-10.11-setup.md
Mac OS X 10.11 El Capitan Setup

Mac OS X 10.11 El Capitan

Custom recipe to get OS X 10.11 El Capitan running from scratch, setup applications and developer environment. This is very similar (and currently mostly the same) as my 10.10 Yosemite setup recipe (as found on this gist https://gist.github.com/kevinelliott/0726211d17020a6abc1f). Note that I expect this to change significantly as I install El Capitan several times.

I use this gist to keep track of the important software and steps required to have a functioning system after a semi-annual fresh install. On average, I reinstall each computer from scratch every 6 months, and I do not perform upgrades between distros.

This keeps the system performing at top speeds, clean of trojans, spyware, and ensures that I maintain good organizational practices for my content and backups. I highly recommend this.

You are encouraged to fork this and modify it to your heart's content to match your own needs.

@dawidof
dawidof / download
Created April 27, 2016 22:36 — forked from guzart/download
bash: Download and Compress Rails API
#!/bin/bash
rm -rf api.rubyonrails.org/
wget -r -k -p http://api.rubyonrails.org/
rm rails_api.rar
rar a -r rails_api.rar api.rubyonrails.org/
@dawidof
dawidof / console
Last active May 29, 2016 06:19
Error in console
$ rails c
Running via Spring preloader in process 26287
Loading production environment (Rails 5.0.0.rc1)
2.3.1 :001 > Commenter.first
Commenter Load (1.4ms) SELECT "commenters".* FROM "commenters" ORDER BY "commenters"."id" ASC LIMIT $1 [["LIMIT", 1]]
=> #<Commenter id: 1, email: "..@facebook.com", encrypted_password: "$2a$11$QY9St83/E6HpX.8G0WJgb.ckimj8m5uvpn2cE9gbV.p...", reset_password_token: nil, reset_password_sent_at: nil, remember_created_at: nil, sign_in_count: 1, comments_count: 4, current_sign_in_at: "2016-05-19 17:13:15", last_sign_in_at: "2016-05-19 17:13:15", current_sign_in_ip: "123.79.106.40", last_sign_in_ip: "123.79.106.40", omni_data: {"provider"=>"facebook", "uid"=>"..", "sex"=>1, "page_url"=>"https://facebook.com/.."}, omni_data_received: {}, admin: true, country_ip: "PL", city_ip: "Warsaw", ip: "123.79.106.40", full_name: "dawidof", blocked_by: nil, blocked_at: nil, hand_up: false, warnings: 0, commenter_hash: "c95c1393-b74f-407d-9cef-0cef637fc4f4", connection_hash: "6439168a-4f86-4
class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
before_action :authenticate_user!, :except => [:index, :about, :contact, :faq]
before_action :configure_permitted_parameters, if: :devise_controller?
set nocompatible
so ~/.vim/plugins.vim
syntax enable
set backspace=indent,eol,start
let mapleader = ','
set number
Copy whole content of the file gg"+yG
Файл настройки: ~/.vimrc
Можно редактировать файлы через сеть, например
:e <scp|ftp|ftps>://user@host/path/to/the/file.txt
:Ex или :e ./ - файловый менеджер
== Основы ==
hjkl перемещение в разные стороны
i режим вставки
@dawidof
dawidof / brew
Created November 30, 2016 17:04
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
@dawidof
dawidof / docker-cleanup-resources.md
Created March 2, 2018 12:00 — forked from bastman/docker-cleanup-resources.md
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm