Skip to content

Instantly share code, notes, and snippets.

View adamdilek's full-sized avatar
🎯
focusing

Adam Dilek adamdilek

🎯
focusing
View GitHub Profile
@adamdilek
adamdilek / centos.sh
Created August 28, 2012 09:19
centos ruby requirements
Ruby (and needed base gems) for your selection will be installed shortly.
Before it happens, please read and execute the instructions below.
Please use a separate terminal to execute any additional commands.
Requirements for Linux ( CentOS release 5.8 (Final) )
NOTE: 'ruby' represents Matz's Ruby Interpreter (MRI) (1.8.X, 1.9.X)
This is the *original* / standard Ruby Language Interpreter
'ree' represents Ruby Enterprise Edition
'rbx' represents Rubinius
@adamdilek
adamdilek / redis.conf
Created August 28, 2012 10:38
redis conf
# This threads are used to read/write data from/to swap file, since they
# also encode and decode objects from disk to memory or the reverse, a bigger
# number of threads can help with big objects even if they can't help with
# I/O itself as the physical device may not be able to couple with many
# reads/writes operations at the same time.
#
# The special value of 0 turn off threaded I/O and enables the blocking
# Virtual Memory implementation.
vm-max-threads 4
@adamdilek
adamdilek / rakeerror.sh
Created August 28, 2012 23:29
Rake error
Muhammets-iMac:birekmek muhammetdilek$ rake dev:setup
Warning: Error loading /Users/muhammetdilek/Documents/projects/birekmek/app/models/user.rb:
Mysql2::Error: Table 'birekmek_development.users' doesn't exist: SHOW FULL FIELDS FROM `users`
/Users/muhammetdilek/.rvm/gems/ruby-1.9.3-p194@birekmek/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:243:in `query'
/Users/muhammetdilek/.rvm/gems/ruby-1.9.3-p194@birekmek/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:243:in `block in execute'
/Users/muhammetdilek/.rvm/gems/ruby-1.9.3-p194@birekmek/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract_adapter.rb:280:in `block in log'
/Users/muhammetdilek/.rvm/gems/ruby-1.9.3-p194@birekmek/gems/activesupport-3.2.6/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/Users/muhammetdilek/.rvm/gems/ruby-1.9.3-p194@birekmek/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract_adapter.rb:275:in
@adamdilek
adamdilek / bir.rb
Created September 3, 2012 10:53
bir
%tr
%td
%td
[email protected]_product
ürün
%td.text-right
-total = 0
[email protected]_items.collect{|line_item| total += line_item.market_product.price}
=number_to_currency(total)
%td
@adamdilek
adamdilek / nginx.conf
Created September 19, 2012 13:27
nginx.conf
user www-data;
worker_processes 4;
pid /var/run/nginx.pid;
events {
worker_connections 768;
# multi_accept on;
}
http {
@adamdilek
adamdilek / default
Created September 19, 2012 13:34
default
# You may add here your
# server {
# ...
# }
# statements for each of your virtual hosts to this file
##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
@adamdilek
adamdilek / gist:4001323
Created November 2, 2012 13:16
devise+rails-api
NoMethodError (undefined method `[]' for nil:NilClass):
warden (1.2.1) lib/warden/session_serializer.rb:31:in `fetch'
warden (1.2.1) lib/warden/proxy.rb:212:in `user'
warden (1.2.1) lib/warden/proxy.rb:318:in `_perform_authentication'
warden (1.2.1) lib/warden/proxy.rb:127:in `authenticate!'
devise (2.1.2) lib/devise/controllers/helpers.rb:48:in `authenticate_user!'
activesupport (3.2.8) lib/active_support/callbacks.rb:407:in `_run__2171702281919698590__process_action__1008680647082847550__callbacks'
activesupport (3.2.8) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.8) lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
activesupport (3.2.8) lib/active_support/callbacks.rb:81:in `run_callbacks'
@adamdilek
adamdilek / products_controller.rb
Created November 2, 2012 13:23
Product Controller
class ProductsController < ApplicationController
before_filter :authenticate_user!
# GET /products
# GET /products.json
def index
@products = Product.all
render json: @products
end
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :token_authenticatable, :confirmable,
# :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable, :token_authenticatable
before_save :ensure_authentication_token
# Setup accessible (or protected) attributes for your model
@adamdilek
adamdilek / error
Created November 9, 2012 21:20
rials new app error
/Users/muhammetdilek/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- /Users/muhammetdilek/config/boot (LoadError)
from /Users/muhammetdilek/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from script/rails:5:in `<main>'