This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Task: Implement the rcat utility and get these tests to pass on a system | |
# which has the UNIX cat command present | |
# To see Gregory Brown's solution, see http://github.com/elm-city-craftworks/rcat | |
# Feel free to publicly share your own solutions | |
# If you want to see detailed commentary on how to solve this problem | |
# please subscribe to the Practicing Ruby Journal ( practicingruby.com ) | |
# An article on this topic will be released on Tuesday 10/18. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Requires supporting ruby files with custom matchers and macros, etc, | |
# in spec/support/ and its subdirectories. | |
Dir[File.expand_path('../support/**/*.rb', __FILE__)].each { |f| require f } | |
# Requires all extra / autoload paths, @see /config/initializers/auto_require.rb | |
# Recommendation: do not rely on autoload for domain objects, use this just for specs | |
unless defined?(Rails) | |
%W( | |
app/persistence | |
app/representers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
grep spec_helper_without_rails -Rl spec/* | xargs rspec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "net/ldap" | |
# assumes ldap login is present in User.username | |
# flow in general: | |
# * find user either by email or username (using provided login) | |
# * if ldap enabled and user provider is ldap, authenticate over ldap | |
# * else validate plain password | |
module Grack | |
class Auth < Rack::Auth::Basic | |
attr_accessor :user, :project |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "net/ldap" | |
=begin | |
fix for older versions, without username in User model | |
flow in general: | |
* authenticate user with ldap | |
return user's email if authenticated, otherwise nil | |
* if email retrieved | |
(ldap authenticated the user) | |
- find user in Gitlab database by that email |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "net/ldap" | |
# if a project belongs to a ldap group | |
# add users from ldap group to the project | |
# remove all other users from the project | |
# else | |
# add all users as usual | |
desc "Add or removes users from projects (admin users are added as masters) respecting LDAP and project groups" | |
task :add_or_remove_users_from_project_teams_using_ldap_groups => :environment do |t, args| | |
gl = Gitlab.config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--colour | |
-I app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# http://stackoverflow.com/questions/3878624/how-do-i-programmatically-determine-if-there-are-uncommited-changes | |
require_clean_work_tree () { | |
# Update the index | |
git update-index -q --ignore-submodules --refresh | |
err=0 | |
# Disallow unstaged changes in the working tree | |
if ! git diff-files --quiet --ignore-submodules --; then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'spec_helper_without_rails' | |
require 'vacuum' | |
describe "search by keywords golden path" do | |
let(:credentials) { YAML::load(File.open("config/amazon.yml"))["test"] } | |
let(:provider) { Vacuum.new.tap { |provider| provider.configure(credentials) } } | |
let(:search_matcher) { | |
lambda do |new_request, saved_request| | |
new_keywords = new_request.uri[/Keywords=(.*)Operation=.*/, 1] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Person { | |
public name | |
public gender | |
public age | |
public Person(name, gender, age) { | |
this.name = name | |
this.gender = gender | |
this.age = age | |
} |
OlderNewer