Skip to content

Instantly share code, notes, and snippets.

View ozgun's full-sized avatar

Ozgun Koyun ozgun

View GitHub Profile
@ozgun
ozgun / bson_object_id.txt
Created January 25, 2013 10:31
BSON:ObjectId('5101b247c0a8050e1496f7fa')
# BSON::ObjectId('5101b247c0a8050e1496f7fa')
#
# 5101b247 c0a8050e 1496 f7fa
#
# * timtestamp = 0x5101b247 # => 1359065671
# * src_ip = 0xc0a8050e # => 192.168.5.14
# * src_port = 0x1496 # => 5270
# * dst_port = 0xf7fa # => 63482
@ozgun
ozgun / dhclient.conf
Created January 27, 2013 12:46
dhcp ile IP alınırken /etc/resolv.conf dosyasına ilgili IP'lerin eklenmesi
...
prepend domain-name-servers 127.0.0.1, 8.8.8.8, 8.8.4.4, 208.67.222.222, 208.67.220.220, 208.67.222.220, 208.67.220.222;
...
@ozgun
ozgun / README
Last active December 11, 2015 21:29
datepicker + timepicker + range + localication + Rails
app/assets/javascripts/admin klasöründe olması gereken js dosyaları:
# jquery-ui-i18n.min.js
# jquery-ui-sliderAccess.js (timepicker)
# jquery-ui-timepicker-addon.js (timepicker)
# jquery-ui-timepicker-tr.js (timepicker)
Timepicker: https://github.com/trentrichardson/jQuery-Timepicker-Addon
app/assets/images/admin/images klasöründe olması gereken resim dosyaları:
@ozgun
ozgun / sinatra-rack-app.rb
Last active December 14, 2015 14:08
Simple sinatra rack app
class AuthApi < Sinatra::Base
get 'ping' do
"pong"
end
get 'ping2' do
"pong2"
end
@ozgun
ozgun / c.c
Created March 21, 2013 12:42
c
void rb_define_method(VALUE klass, const char *name, VALUE (*func)(), int argc)
public class DowncastingExample {
public static void main(String args[]) {
Object a = new Hayvan();
Hayvan b = (Hayvan) a; // aşağıya çevirim, downcasting
}
}
public class DowncastingExample {
public static void main(String args[]) {
Object[] o = new Object[2];
o[0] = new Hayvan(); // upcasting
o[1] = new Kedi(); // upcasting
Hayvan a2 = (Hayvan) o[0]; // downcasting
Kedi a3 = (Kedi) o[1]; // downcasting
test vim gist
@ozgun
ozgun / save_css_xhr
Created September 6, 2013 12:20
save_css_xhr
def save_css_xhr
file = @s_site.css_file(:write => true)
file.write(params[:code])
file.close
respond_to do |format|
format.js { }
end
end
@ozgun
ozgun / gist:7089225
Created October 21, 2013 19:09
ActionMailer settings
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
:enable_starttls_auto => true,
:port => 587,
:address => "mx.yandex.net",
:user_name => "test@example.com",
:password => "12345",
:domain => "example.com",
:authentication => :plain
}