Skip to content

Instantly share code, notes, and snippets.

@webmock
Feature: Sign up with Twitter account
In order to log into the system
As a user
I want to register a new account with the system with my Twitter account
Scenario: User signs up with Twitter account
Given the Twitter OAuth request is successful
When I go to the sign up page
And I follow "Sign in with Twitter"
Post.fetch # fetch post from remote resources and save to the Post
Post::Tumblr.fetch # fetch post from Tumblr and save to the Post
Feature: Create a multichoice question
In order to qualify team members based on internal standards
As an Admin
I want to be able to create a multiple choice question pool to create standards tests
Background:
Given I am an authenticated user
And I am on the new question page
Scenario: Admin creates new question
@timurvafin
timurvafin / gist:849308
Created March 1, 2011 15:39
jquery.multiply_fields.js
(function($) {
$.fn.multiply_fields = function(options) {
var settings = {
'item': '.item',
'add-trigger': '.add-trigger',
'remove-trigger': '.remove-trigger'
};
return this.each(function() {
Host *.amazonaws.com
StrictHostKeyChecking no
@timurvafin
timurvafin / old-repos.rb
Created March 31, 2011 09:14
Get list of private repos without commits more then 12 months
require 'rubygems'
require 'bundler/setup'
require 'octokit'
require 'active_support/core_ext'
@username = 'repo user name'
def client
@client ||= Octokit::Client.new(:login => 'login', :token => 'token')
end
class ActiveRecord::Base
validate do |record|
record.class.columns.select{|c| [:string, :text].include?(c.type) && c.limit.present? }.each do |column|
validator = ActiveModel::Validations::LengthValidator.new(:attributes => [column.name], :maximum => column.limit)
validator.validate(record)
end
end
end

Git

Git - распределённая система управления версиями файлов.

  • работа в offlen: создание репозитория, коммиты, работа с ветками, полная и копия всех версий

  • супер быстрое и удобное слияние веток

Полцентрализованная система

# класс для работы с рядом
class Series
def initialize
@result = [[1]] # каждый элемент ряда - массив
end
# добавить в ряд элемент
def push( element )
@result.push( element )