Skip to content

Instantly share code, notes, and snippets.

View adamdilek's full-sized avatar
🎯
focusing

Adam Dilek adamdilek

🎯
focusing
View GitHub Profile
# Install postgres 9.2
vi /etc/apt/sources.list.d/pgdg.list
# Add lines below
deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main
# Run and Install postgres 9.2
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get install postgresql-9.2
@adamdilek
adamdilek / iconCls.txt
Created March 20, 2014 07:38
Sencha Touch iconCls Values
Sencha Touch iconCls Values
---------------------------
action
add
arrow_down
arrow_left
arrow_right
arrow_up
bookmarks
namespace :settings do
desc 'Setup settings.'
task :setup do
run "mkdir -p #{shared_path}/config/settings"
put File.read('config/settings.local.yml'), "#{shared_path}/config/settings.yml"
put File.read('config/settings/staging.local.yml'), "#{shared_path}/config/settings/staging.yml"
put File.read('config/settings/production.local.yml'), "#{shared_path}/config/settings/production.yml"
put File.read('config/s3.local.yml'), "#{shared_path}/config/s3.yml"
@adamdilek
adamdilek / routes.rb
Created February 11, 2014 11:23
Rails locale url and to_param
#routes
namespace :hq do
scope "(:locale)", :locale => /en|tr|ru/ do
resources :pages
end
end
#Page model
def to_param
"#{id}-#{title.present? ? title.parameterize : ''}"
$.getJSON "/locations/districts?city_id=" + city_id + "&callback=?", (data) ->
$.each data, (i, item) ->
$(".register_temp_invoice_info_delivery_district_id").append "<option value=" + item.id + ">" + item.name + "</option>"
namespace :dev do
# Just run development env
# This code run insert seed and agency data
# A simple trick to over migration problem
task :setup => [:environment] do
raise 'Nah, You are at production' if Rails.env.production?
Rake::Task['dev:kill_postgres_connections'].execute
Rake::Task['db:drop'].execute
Rake::Task['db:create'].execute
Rake::Task['db:migrate'].execute
$(".booking_form").html("<%= escape_javascript( render(:partial => "booking_form") ) %>");
config.action_mailer.default_url_options = { :host => 'muhammet.com' }
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:address => "smtp.gmail.com",
:port => 587,
:domain => 'gmail.com',
:user_name => '[email protected]',
:password => 'ab2014',
:authentication => 'plain',
:enable_starttls_auto => true
require 'spec_helper'
describe Product do
let(:product) { FactoryGirl.build :product }
describe 'attributes' do
# Validations
it { expect(product).to validate_presence_of :name }
it { expect(product).to validate_presence_of :description }
@adamdilek
adamdilek / message.rb
Created January 23, 2014 11:29
TTmesaj Ruby
client = Savon::Client.new(wsdl: "http://ws.ttmesaj.com/service1.asmx?WSDL")
message = {
"username" => "kullanici adi",
"password" => "sifre",
"numbers" => "Numara",
"message" => "Deneme",
"origin" => "origin",
"sd" => "",
"ed" => "" }
response = client.call( :send_single_sms, message: message)