Skip to content

Instantly share code, notes, and snippets.

View halilim's full-sized avatar

Halil Özgür halilim

View GitHub Profile

Keybase proof

I hereby claim:

  • I am halilim on github.
  • I am halil (https://keybase.io/halil) on keybase.
  • I have a public key ASCTFoy6Tqz9aQRrOCeOjMkn9M_xyoPNpU3g5_mbYMCpTgo

To claim this, I am signing this object:

CIPHER = { 'a' => 'n', 'b' => 'o', 'c' => 'p', 'd' => 'q',
'e' => 'r', 'f' => 's', 'g' => 't', 'h' => 'u',
'i' => 'v', 'j' => 'w', 'k' => 'x', 'l' => 'y',
'm' => 'z', 'n' => 'a', 'o' => 'b', 'p' => 'c',
'q' => 'd', 'r' => 'e', 's' => 'f', 't' => 'g',
'u' => 'h', 'v' => 'i', 'w' => 'j', 'x' => 'k',
'y' => 'l', 'z' => 'm' }.freeze
REVERSE_CIPHER = CIPHER.invert.freeze
@halilim
halilim / assets.rb
Created January 16, 2016 23:48
A working CDN config for galetahub/ckeditor which doesn't copy/precompile CKEditor's own assets.
# config/initializers/assets.rb
# ...
# The last two are for the file browser
Rails.application.config.assets.precompile += %w(ckeditor/config ckeditor/application ckeditor/filebrowser/*)
@halilim
halilim / helpers.rb
Last active March 28, 2016 14:08
Rails RSpec I18n full error message helper for Capybara feature tests. Feels like there should be a better way, ping me if you can find one :) Stack Overflow link: http://stackoverflow.com/questions/34494599/rails-i18n-full-error-messages-in-rspec-capybara-feature-tests
# spec/support/helpers.rb
require 'support/helpers/i18n_helpers'
# ...
RSpec.configure do |config|
config.include Features::I18nHelpers, type: :feature
# ...
end
@halilim
halilim / Chewy_price_filter.rb
Last active November 29, 2015 23:44
A stab at Elastic script filters for a multi-currency price filter
# Assumes gems: Chewy, Money and eu_central_bank
class SearchForm
include ActiveModel::Model
DEFAULTS = { 'currency' => 'TRY' }
attr_accessor :price_min, :price_max, :currency
# ...
@halilim
halilim / digitize_benchmark.rb
Last active November 19, 2015 20:34
Benchmark various digitization methods
require 'benchmark/ips'
def digits_s(n)
n.to_s.chars.map(&:to_i)
end
# http://stackoverflow.com/a/12909952/372654
def digits_divmod(n)
n = n.abs
[].tap do |result|
@halilim
halilim / Amazon Elastic Beanstalk Rails.md
Last active December 23, 2016 09:42
"Actually" getting Amazon Elastic Beanstalk to work for a Rails 4 application with 12 Factor and Heroku compatibility

Last Status

  • 2015-11-10: Abandoned AWS EB.

    Got Create environment operation is complete, but with errors. For more information, see troubleshooting documentation..

    Tried to set up CloudWatch Logs but got The following resource(s) failed to create: [AWSEBCWLHttp4xxMetricFilter, AWSEBCWLHttp5xxMetricFilter].

@halilim
halilim / migrations.rb
Last active September 10, 2015 19:44
Bare bones e-commerce Rails models
class CreateTables < ActiveRecord::Migration
def change
create_table :products do |t|
# ...
end
create_table :orders do |t|
# ...
end
create_table :order_items do |t|
t.references :order, index: true, foreign_key: true
@halilim
halilim / Comodo Essential SSL CA Bundle.md
Last active August 29, 2015 14:26
Comodo Essential SSL CA Bundle

Concatenate the files in the following order:

Root CA Certificate - AddTrustExternalCARoot.crt
Intermediate CA Certificate - COMODORSAAddTrustCA.crt
Intermediate CA Certificate - COMODORSADomainValidationSecureServerCA.crt
Your EssentialSSL Certificate - www_example_com.crt *

(*) Exclude the real certificate "www_example_com.crt" if CA bundle is entered separately.