Skip to content

Instantly share code, notes, and snippets.

View letmein's full-sized avatar
🏠
Working from home

Yuriy Kharchenko letmein

🏠
Working from home
  • Armenia, Yerevan
  • 18:02 (UTC +04:00)
View GitHub Profile
use Mix.Config
# For development, we disable any cache and enable
# debugging and code reloading.
#
# The watchers configuration can be used to run external
# watchers to your application. For example, we use it
# with brunch.io to recompile .js and .css sources.
config :poker_web, PokerWeb.Endpoint,
http: [port: 4000],
@letmein
letmein / application_mailer.rb
Created May 5, 2017 18:11
spec/support/application_mailer.rb
# frozen_string_literal: true
module MailerNameHeader
extend ActiveSupport::Concern
included do
after_action :set_headers
end
private
@letmein
letmein / profile.js
Last active September 9, 2016 10:40
profile a function in console
measure = function (subj) {
var t0 = performance.now()
subj()
var t1 = performance.now()
return (t1 - t0) + 'ms'
}
arr = _.times(10000, function (i) { return { id: i, name: 'Foo ' + i } })
index = _.keyBy(arr, 'id')
arr2 = _.times(5000, function (i) { return { id: i + 1, name: 'Foo ' + i +1 } })
@letmein
letmein / backtrace
Created March 14, 2016 12:05
delayed_job error
15:04:08 dj.1 | FATAL: invalid frontend message type 0
15:04:08 dj.1 | PG::ConnectionBad: PQsocket() can't get socket descriptor: SHOW search_path
15:04:08 dj.1 | /Users/yuriy/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/postgresql/database_statements.rb:147:in `async_exec'
15:04:08 dj.1 | /Users/yuriy/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/postgresql/database_statements.rb:147:in `block in query'
15:04:08 dj.1 | /Users/yuriy/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract_adapter.rb:472:in `block in log'
15:04:08 dj.1 | /Users/yuriy/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.5/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
15:04:08 dj.1 | /Users/yuriy/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract_ada
@letmein
letmein / init.vim
Created December 19, 2015 11:51
neovim config
let $NVIM_TUI_ENABLE_TRUE_COLOR=1
let $NVIM_TUI_ENABLE_CURSOR_SHAPE=1
filetype plugin on
filetype indent on
syntax on
"set hlsearch
set tabstop=2
alias gg="git grep -n --heading --break"
@letmein
letmein / .bash_prompt
Created April 19, 2015 19:03
bash prompt for rbenv & git
#!/bin/bash
# Add this to the end of .bashrc
# prompt with ruby version
# rbenv version | sed -e 's/ .*//'
__rbenv_ps1 ()
{
rbenv_ruby_version=`rbenv version | sed -e 's/ .*//'`
printf $rbenv_ruby_version
}
@letmein
letmein / .bashrc
Last active August 29, 2015 14:01
Ubuntu config
set -o vi
txtblk='\e[0;30m' # Black - Regular
txtred='\e[0;31m' # Red
txtgrn='\e[0;32m' # Green
txtylw='\e[0;33m' # Yellow
txtblu='\e[0;34m' # Blue
txtpur='\e[0;35m' # Purple
txtcyn='\e[0;36m' # Cyan
txtwht='\e[0;37m' # White
@letmein
letmein / .vimrc
Last active August 29, 2015 13:57
" Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern.
if &t_Co > 2 || has("gui_running")
syntax on
set hlsearch
endif
if has("gui_running")
" GUI is running or is about to start.
" Maximize gvim window.
@letmein
letmein / my.vim
Last active August 29, 2015 13:57
My color scheme for vim (based on softblue)
" Vim color file
" Maintainer: Zhang Jing
" Last Change: %[% 2005Äê12ÔÂ07ÈÕ ÐÇÆÚÈý 10ʱ41·Ö49Ãë %]%
set background=dark
if version > 580
hi clear
if exists("syntax_on")
syntax reset
endif