Skip to content

Instantly share code, notes, and snippets.

View adamdilek's full-sized avatar
🎯
focusing

Adam Dilek adamdilek

🎯
focusing
View GitHub Profile
# This is a skeleton for testing models including examples of validations, callbacks,
# scopes, instance & class methods, associations, and more.
# Pick and choose what you want, as all models don't NEED to be tested at this depth.
#
# I'm always eager to hear new tips & suggestions as I'm still new to testing,
# so if you have any, please share!
#
# @kyletcarlson
#
# This skeleton also assumes you're using the following gems:
@adamdilek
adamdilek / removepackage.sh
Last active December 26, 2015 10:39
Remove apache and mysql
if sudo dpkg -s apache2 | grep -q Status; then
echo "Package 'apache2' is installed."
echo "Removin 'apache2'. Please wait..."
service apache2 stop
sudo apt-get -y --purge remove apache2*
else
echo "Package 'apache2' is NOT installed."
fi
if sudo dpkg -s mysql-server | grep -q Status; then
# Use this setup block to configure all options available in SimpleForm.
# File Path: RAILS_ROOT/config/initializers/simple_form_bootstrap.rb
SimpleForm.setup do |config|
config.wrappers :bootstrap, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
b.use :html5
b.use :placeholder
b.use :label, class: 'control-label'
b.use :input
b.use :error, wrap_with: { tag: 'span', class: 'help-block' }
b.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
@adamdilek
adamdilek / bootstrap-and-rails-tricks.md
Created September 10, 2013 06:36
Bootstrap and Rails Tricks

Search Form Oluşturma

Search Form

= search_form_for @search, builder: SimpleForm::FormBuilder do |f|
  .input-group
    = f.input_field :name_cont, label: false, input_html: {class: 'form-control'}, placeholder: 'Quick search...'
    %span.input-group-btn
 = button_tag( class: 'btn') do
@adamdilek
adamdilek / postgres.md
Last active December 20, 2015 08:28
PostgreSQL Notlarım

postgres kullanıcısına geçiş

sudo su postgres

daha sonra psql ile postgres veritabanına bağlanabilirsiniz.

Veritabanı oluşturma

module ApplicationHelper
def format_state(state, large = false)
capture_haml do
css_classes = %w(label)
css_classes << state
css_classes << 'large' if large
haml_tag :span, class: css_classes do
haml_concat t("helpers.state.#{state}")
end
end
str = "Привет"
str.mb_chars.downcase.to_s#=> "привет"
devise_for :users,
:controllers => { :sessions => 'sessions', :registrations => 'registrations'},
:path => 'accounts',
:path_names => { :sign_in => 'login', :sign_up => 'new', :sign_out => 'logout', :password => 'secret',
:confirmation => 'verification' }
@adamdilek
adamdilek / index.html.haml
Created May 22, 2013 01:42
Haml içine javascript yazmak
%script{:type=>"text/javascript"}
alert("sa")
@adamdilek
adamdilek / gist:5620173
Last active December 17, 2015 13:49
form.html.haml
= f.select :suburb_town_region_country_id_eq, @countries.map{|country| [country.name, country.id]}, {}, :id => 'country'
= f.select :suburb_town_region_id_eq, @regions.map{|region| [region.name, region.id]}, {}, :id => 'region'
= f.select :suburb_town_id_eq, @towns.map{|town| [town.name, town.id]}, {}, :id => 'town'
= f.select :suburb_id_eq, @suburbs.map{|suburb| [suburb.name, suburb.id]}, {}, :id => 'suburb'