Skip to content

Instantly share code, notes, and snippets.

View the-teacher's full-sized avatar
💻
Working remotely

Ilya N. Zykin the-teacher

💻
Working remotely
View GitHub Profile
@the-teacher
the-teacher / git-terminal.bash
Created December 22, 2013 10:52
git-terminal.bash
WHITE="\[\033[00m\]"
RED="\[\033[31m\]"
GREEN="\[\033[32m\]"
# Git branch in prompt.
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'
}
export PS1="\u@\h $RED\W$WHITE::$GREEN\$(parse_git_branch)$WHITE $ "
@the-teacher
the-teacher / dragfix.coffee
Created December 22, 2013 20:19
dragfix.coffee
$(".content-editor > .content").sortable
items: ".plugin"
handle: ".head"
#!/usr/bin/env bash
# Simple move this file into your Rails `script` folder. Also make sure you `chmod +x puma.sh`.
# Please modify the CONSTANT variables to fit your configurations.
# The script will start with config set by $PUMA_CONFIG_FILE by default
PUMA_CONFIG_FILE=config/puma.rb
PUMA_PID_FILE=tmp/pids/puma.pid
PUMA_SOCKET=tmp/sockets/puma.sock
@the-teacher
the-teacher / puma.rb
Created January 5, 2014 06:11 — forked from merqlove/puma.rb
# Capistrano 3 tasks for Puma
namespace :puma do
%w[start stop restart status].each do |command|
desc "#{command} puma"
task command do
on roles (:app) do
within current_path do
execute "bin/puma.sh", "#{command} -c config/puma/#{fetch(:stage)}.rb"
@the-teacher
the-teacher / cap
Created January 13, 2014 20:25
cap
gem 'capistrano', github: "capistrano/capistrano"
gem 'capistrano-bundler', github: "capistrano/bundler"
gem 'capistrano-rvm', github: "capistrano/rvm"
gem 'capistrano-rails', github: "capistrano/rails"
@the-teacher
the-teacher / prepend_view_path.rb
Created January 14, 2014 09:29
config/initializers/action_mailer_extensions.rb:
module ActionMailer
class Base
class_inheritable_accessor :view_paths
def self.prepend_view_path(path)
view_paths.unshift(*path)
ActionView::TemplateFinder.process_view_paths(path)
end
def self.append_view_path(path)
@the-teacher
the-teacher / fields.rb
Created February 23, 2014 15:49
AR model fields
LeaveBenefit.attribute_names.collect { |att| att.to_sym }
module.exports = (grunt) ->
# Project configuration.
grunt.initConfig
coffee:
options:
sourceMap: false
app:
expand: true
cwd: 'public/js/coffee/'
@the-teacher
the-teacher / commands
Last active August 29, 2015 13:57
Digital ocean - Ubuntu Rails
ssh [email protected]
ssh [email protected]
mkdir -p ~/.ssh
cat ~/.ssh/id_rsa.pub | ssh [email protected] 'cat >> ~/.ssh/authorized_keys'
cat ~/.ssh/id_rsa.pub | ssh [email protected] 'cat >> ~/.ssh/authorized_keys'
User: rails
def silence &block
(begin; yield; rescue; end;) if block_given?
end