This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function() { | |
$(".ajax_request").bind('ajax:before', function(evt, status, data, xhr) { | |
showAjaxLoading(); | |
}); | |
$(".ajax_request").bind('ajax:complete', function(evt, status, data, xhr) { | |
hideAjaxLoading(); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
DATETIME=`date +%Y.%m.%d_%H.%M.%S` | |
DB_NAME="test" | |
BACKUP_FILE="/home/ozgun/backups/${DB_NAME}-${DATETIME}.sql" | |
/usr/bin/mysqldump -uroot --default-character-set=utf8 $DB_NAME > $BACKUP_FILE | |
/bin/gzip $BACKUP_FILE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# gem install mongo | |
# gem install bson_ext | |
require "benchmark" | |
require 'json' | |
require 'mongo' | |
@conn = Mongo::Connection.new | |
@db = @conn['test9'] | |
@coll = @db['items'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# gem install redis | |
require 'redis' | |
redis = Redis.new | |
1_000_000.times do |i| | |
redis.set("mykey#{i}", "sdfasdfasdfasfsfsdfsfsdfasdfasdfasdfasdfsadfsdfsdfsdfsdfasdfasdfasfasdfasdfasdfsadf") | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
! caps lock tusu ctrl gibi davransin | |
remove Lock = Caps_Lock | |
keycode 66 = Control_L | |
add Control = Control_L |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
test = {"deneme1" => 2, "deneme2" => 5, "deneme3" => 1} | |
test.values.sort.inject({}){|memo, x| memo.merge(test.key(x) => x) } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Örnek: | |
* | |
* <div class="toggle_on_click" data-toggle_target=".abc span">Toggle</div> | |
* <div class="abc"> | |
* <span>ABC</span> | |
* </div> | |
*/ | |
$('.toggle_on_click').live('click', function() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%= f.input :kind, label: t('category.post.display.display') do %> | |
<%= f.input_field :kind, as: :select, | |
collection: [[t('category.post.display.full'), 'full'], [t('category.post.display.summary'), 'short'], | |
[t('category.post.display.word.word'), 'word']], | |
include_blank: false %> | |
<%= f.input :word_count, label: t('category.post.display.word.count'), wrapper_html: { id: 'category_word_count_div', class: 'hidden' } %> | |
<%= f.input :image_container, wrapper_html: { id: 'img_container', class: "hidden" }, label: t('image.image') do %> | |
<%= f.input_field :img, as: :boolean %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 1980-01-01 ile 2012-12-04 18:22:27 +0200 tarihleri arasındaki kayıtların listelenmesi. | |
// İlk 5 kayıt atlanır | |
// 10 kayıt listelenir | |
// id'ye göre tersten sıralama yapılır | |
// tablo(collection) adı: reports | |
db.reports.find({"_id": { "$gte": ObjectId('12cea6000000000000000000'), "$lte": ObjectId('50be23430000000000000000') }}).sort({ "_id": -1 }).skip(5).limit(10); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mongoimport -d db_name -c reports --file data.json |