Skip to content

Instantly share code, notes, and snippets.

View dzaporozhets's full-sized avatar

Dmitriy Zaporozhets dzaporozhets

View GitHub Profile
@dzaporozhets
dzaporozhets / gist:3826869
Created October 3, 2012 13:21
disable button
(($) ->
# 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)
@dzaporozhets
dzaporozhets / gist:3826391
Created October 3, 2012 10:57
Disable form buttons while a form is submitting
$ ->
# 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()
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
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
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
@dzaporozhets
dzaporozhets / gist:3696927
Created September 11, 2012 08:35
seed data
# Seed cucumber data
require 'seed-fu'
SeedFu.quiet = true
puts "Seeding data...(checkout db/fixtures/test)"
SeedFu.seed(Rails.root.join('db/fixtures/test'
#Newbie programmer
def factorial(x):
if x == 0:
return 1
else:
return x * factorial(x - 1)
print factorial(6)
#First year programmer, studied Pascal
@dzaporozhets
dzaporozhets / gist:3065552
Created July 7, 2012 08:59 — forked from justincjahn/gist:3062860
Gitlab init.d for RedHat based distributions.
#!/bin/bash
#
# GitLab Runs unicorn and resque for nginx integration.
###
# chkconfig: 35 98 55
# processname: unicorn
# processname: resque
# description: Runs unicorn and resque for nginx integration.
###
@dzaporozhets
dzaporozhets / whitespace.rake
Created June 5, 2012 08:06 — forked from NARKOZ/whitespace.rake
Whitespaaaaaaaace! WHITESPAAAAAAAACE!
namespace :whitespace do
desc 'Removes trailing whitespace'
task :cleanup do
sh %{for f in `find . -type f | grep -v .git | grep -v ./vendor | grep -v ./tmp | egrep ".(rb|js|haml|html|css|sass)"`;
do sed -i '' 's/ *$//g' "$f";
done}, {:verbose => false}
puts "done"
end
desc 'Converts hard-tabs into two-space soft-tabs'
cucumber -r features features/users