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
#Newbie programmer | |
def factorial(x): | |
if x == 0: | |
return 1 | |
else: | |
return x * factorial(x - 1) | |
print factorial(6) | |
#First year programmer, studied Pascal |
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
# Seed cucumber data | |
require 'seed-fu' | |
SeedFu.quiet = true | |
puts "Seeding data...(checkout db/fixtures/test)" | |
SeedFu.seed(Rails.root.join('db/fixtures/test' |
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
sudo adduser \ | |
--system \ | |
--shell /bin/sh \ | |
--gecos 'git version control' \ | |
--group \ | |
--disabled-password \ | |
--home /home/git \ | |
git | |
# ubuntu/debian | |
sudo adduser --disabled-login --gecos 'gitlab system' gitlab |
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
sudo gem install charlock_holmes --version '0.6.8' | |
sudo pip install pygments | |
sudo gem install bundler | |
cd /home/gitlab | |
# Skip this for stable setup. | |
# Master branch (recent changes, less stable) | |
sudo -H -u gitlab git clone -b master https://github.com/gitlabhq/gitlabhq.git gitlab | |
cd gitlab |
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
sudo apt-get update | |
sudo apt-get upgrade | |
sudo apt-get install -y wget curl gcc checkinstall libxml2-dev libxslt-dev sqlite3 libsqlite3-dev libcurl4-openssl-dev libreadline6-dev libc6-dev libssl-dev libmysql++-dev make build-essential zlib1g-dev libicu-dev redis-server openssh-server git-core python-dev python-pip libyaml-dev postfix | |
# If you want to use MySQL: | |
sudo apt-get install -y mysql-server mysql-client libmysqlclient-dev | |
wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p194.tar.gz | |
tar xfvz ruby-1.9.3-p194.tar.gz |
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
$ -> | |
# Disable form buttons while a form is submitting | |
$('body').on 'ajax:complete, ajax:beforeSend, submit', 'form', (e) -> | |
buttons = $('[type="submit"]', this) | |
switch e.type | |
when 'ajax:beforeSend', 'submit' | |
buttons.disable() | |
else | |
buttons.enable() |
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
(($) -> | |
# Disable an element and add the 'disabled' Bootstrap class | |
$.fn.extend disable: -> | |
$(this).attr('disabled', 'disabled').addClass('disabled') | |
# Enable an element and remove the 'disabled' Bootstrap class | |
$.fn.extend enable: -> | |
$(this).removeAttr('disabled').removeClass('disabled') | |
)(jQuery) |
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
apt-get install xvfb | |
apt-get install firefox |
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
# GITOLITE 3 | |
sudo -u git -H sed -i "s/\(GIT_CONFIG_KEYS\s*=>*\s*\).\{2\}/\1'\.\*'/g" /home/git/.gitolite.rc | |
# GITOLITE 2 | |
sudo -u git -H sed -i 's/\(GL_GITCONFIG_KEYS\s*=>*\s*\).\{2\}/\1"\.\*"/g' /home/git/.gitolite.rc |
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
def select_from_chosen(item_text, options) | |
field = find_field(options[:from]) | |
option_value = page.evaluate_script("$(\"##{field[:id]} option:contains('#{item_text}')\").val()") | |
page.execute_script("$('##{field[:id]}').val('#{option_value}')") | |
end |