As configured in my dotfiles.
start new:
tmux
start new with session name:
#! /bin/sh | |
### BEGIN INIT INFO | |
# Provides: redis-server | |
# Required-Start: $syslog | |
# Required-Stop: $syslog | |
# Should-Start: $local_fs | |
# Should-Stop: $local_fs | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: redis-server - Persistent key-value db |
@import "active_admin/mixins" | |
@import "active_admin/components/links" | |
body | |
@include global-reset | |
@import "active_admin/typography" | |
@import "active_admin/header" | |
@import "active_admin/forms" | |
@import "active_admin/components/comments" | |
@import "active_admin/components/flash_messages" |
" | |
set nocompatible | |
" vundle init (github.com/gmarik/vundle) | |
set rtp+=~/.vim/bundle/vundle/ | |
call vundle#rc() | |
" let Vundle manage Vundle, required! | |
Bundle 'gmarik/vundle' |
# coding utf-8 | |
class Array | |
def pmap | |
pipes, out = [], [] | |
each do |e| | |
r, w = IO.pipe | |
Process.fork do | |
r.close |
/* | |
* Разбивает массив на колонки | |
*/ | |
function array_split($array, $pieces=2) | |
{ | |
if ($pieces < 2) | |
return array($array); | |
$newCount = ceil(count($array)/$pieces); | |
$a = array_slice($array, 0, $newCount); | |
$b = array_split(array_slice($array, $newCount), $pieces-1); |
<? | |
/** | |
* Отправка письма с атачем | |
* | |
* Example: | |
* | |
* AddEventHandler("main", "OnBeforeEventAdd", array("MainHandlers", "OnBeforeEventAddHandler")); | |
* class MainHandlers | |
* { | |
* function OnBeforeEventAddHandler($event, $lid, $arFields) |
As configured in my dotfiles.
start new:
tmux
start new with session name:
class PostsController < ActionController::Base | |
def create | |
Post.create(post_params) | |
end | |
def update | |
Post.find(params[:id]).update_attributes!(post_params) | |
end | |
private |
# coding: utf-8 | |
require 'spec_helper' | |
require 'rake' | |
describe 'companies:destroy_from_csv' do | |
let(:filename) { 'old_companies.csv' } | |
let(:dir) { File.join(Rails.root, 'tmp', 'companies') } | |
let(:file) { File.join(dir, filename)} | |
let(:log) { File.join(dir, 'not_deleted.log')} | |
let(:company) { create :company } |
10 context 'when update products with valid data' do | |
9 it do | |
8 meta = described_class.enqueue(company.id, bind_data) | |
7 binding.pry #NOTE: debugger | |
6 | |
5 Resque.inline = true | |
4 worker = Resque::Worker.new(:company_products) | |
3 binding.pry #NOTE: debugger | |
2 worker.work(0) | |
1 |