Skip to content

Instantly share code, notes, and snippets.

@sharshenov
sharshenov / gist:793e6dee2c5bee9d82d6
Last active December 5, 2016 16:47
Конфигурация elasticsearch для нужд небольших проектов(никакого HighAvailability & Load Balancing)
# Добавляем репозиторий для oracle java
add-apt-repository ppa:webupd8team/java
# Добавляем репозиторий для elasticsearch
wget -qO - https://packages.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
echo "deb http://packages.elastic.co/elasticsearch/2.x/debian stable main" | sudo tee -a /etc/apt/sources.list.d/elasticsearch-2.x.list
# Обновить систему
apt-get update && apt-get dist-upgrade -y && apt-get autoremove -y && apt-get clean
@tatyshev
tatyshev / errors_for.rb
Created August 18, 2015 11:40
missing errors_for method for formBuilder
module ActionView
module Helpers
class FormBuilder
include ActionView::Helpers::TagHelper
include ActionView::Context
def errors_for(object_name, options = {})
return if (errors = object.errors[object_name]).empty?
options[:class] ||= 'form_input-errors' # default class
@subfuzion
subfuzion / redis-autostart-osx.md
Last active April 26, 2024 21:40
redis auto start OS X

Install with Homebrew

brew install redis

Set up launchctl to auto start redis

$ ln -sfv /usr/local/opt/redis/*.plist ~/Library/LaunchAgents

/usr/local/opt/redis/ is a symlink to /usr/local/Cellar/redis/x.y.z (e.g., 2.8.7)

@valerykalashnikov
valerykalashnikov / js_precommit_hook
Last active October 4, 2018 08:13
Precommit hook to prevent console.log, debugger and binding.pry
#!/bin/bash
#Precommit hook to prevent "debugger" and "console.log"
#Note: to enamble precommit on Windows machine don't forget add path to Git\bin and Git\cmd to PATH environment variable
count=0
for FILE in `git diff-index --name-status HEAD -- | cut -c3-` ; do
# Check if the file contains 'debugger' or 'console.log'
contains=`grep -e "debugger" -e "console\.log" -e "binding\.pry" $FILE`
if [ `grep -e "debugger" -e "console\.log" -e "binding\.pry" $FILE|wc -l` -ne 0 ]