Skip to content

Instantly share code, notes, and snippets.

View leylaKapi's full-sized avatar
💭
I may be slow to respond.

Leyla Kapi Kurtul leylaKapi

💭
I may be slow to respond.
  • Hamburg / Germany
View GitHub Profile
@leylaKapi
leylaKapi / info.sh
Created February 27, 2017 11:07
ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'db'
mysql -u root -p
// No, you should run mysql -u root -p in bash, not at the MySQL command-line. If you are in mysql, you can exit by typing exit.
@leylaKapi
leylaKapi / remote_zip_tar.sh
Created February 27, 2017 11:09
Remote zip or tar
//In remote
➜ ~ tar czvf compressed.tar.gz directory1
https://www.digitalocean.com/community/tutorials/an-introduction-to-file-compression-tools-on-linux-servers
//In Locale
➜ ~ scp -r username@ip:compressed.tar.gz /Users/johndoe/Desktop/backup.tar.gz
@leylaKapi
leylaKapi / app.js
Created February 27, 2017 11:09
footable.js empty error
$('.table').footable({
"toggleColumn": "last",
"expandFirst": true,
"empty": "no results",
"columns": [
{ "name": "id", "title": "ID", "breakpoints": "xs" },
{ "name": "firstName", "title": "First Name" },
{ "name": "lastName", "title": "Last Name" },
{ "name": "jobTitle", "title": "Job Title", "breakpoints": "xs" },
{ "name": "started", "title": "Started On", "breakpoints": "xs sm" },
@leylaKapi
leylaKapi / info.md
Created February 27, 2017 11:11
Wordpress setup on Mac
@leylaKapi
leylaKapi / controller.rb
Created February 27, 2017 11:12
Filter according to categories
@models = Model.joins(:categories).where('categories.id = ?', @categories_id).order("created_at DESC").paginate(page: params[:page])
@leylaKapi
leylaKapi / dumb.sh
Created February 27, 2017 11:13
pg_dumb
psql asdf_development < /Users/johndoe/Desktop/db_dump.sql
@leylaKapi
leylaKapi / link.haml
Created February 27, 2017 11:15
Giving path to link_to with id
@leylaKapi
leylaKapi / trigger.rb
Created February 27, 2017 11:15
trigger
after_save :update_subtotal
def calc_subtotal
order_items.includes(:model).collect {|oi| oi.valid? ? (oi.unit_price.to_f) : 0}.sum
end
def update_subtotal
self.update_column(:subtotal, calc_subtotal)
end
@leylaKapi
leylaKapi / devise.tr.yml
Created April 24, 2017 14:38 — forked from cihad/devise.tr.yml
Turkish translations for Devise
# Additional translations at https://github.com/plataformatec/devise/wiki/I18n
tr:
devise:
confirmations:
confirmed: "Eposta adresiniz başırılı bir şekilde onaylandı."
send_instructions: "Bir kaç dakika içerisinde eposta adresinizi nasıl onaylayacağınız hakkında bir eposta alacaksınız."
send_paranoid_instructions: "Eğer eposta adresinizi veritabanımızda kayıtlı ise bir kaç dakika içerisinde eposta adresinizi nasıl onaylayacağınız hakkında bir eposta alacaksınız."
failure:
already_authenticated: "Zaten giriş yaptınız."
@leylaKapi
leylaKapi / app.coffee
Created July 11, 2017 12:51
Add ancestry gem and nested categories list with js
$('.tree li').show()
$('.tree li').on 'click', (e) ->
children = $(this).find('> ul > li')
if children.is(':visible')
children.hide 'fast'
else
children.show 'fast'
e.stopPropagation()
return
return