Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View baybatu's full-sized avatar
🏠
Working from home

Batuhan Bayrakci baybatu

🏠
Working from home
View GitHub Profile
@baybatu
baybatu / gist:2884901
Created June 6, 2012 21:27
Windows Konsolda Türkçe Karakterlerin Gösterilmesi
Bunun için iki adım gereklidir.
1. Konsolun yazı tipini TrueType bir yazı tipine çevirmek gerekir. Lucida Console ya da Consolas olabilir.
2. chcp 1254 komutu ile kod sayfasını değiştirmek
@baybatu
baybatu / dosya_zaman.py
Created June 25, 2012 17:47
Python'da dosyanın son değiştirme zamanını almak
import os
(mode, ino, dev, nlink, uid, gid, size, atime, mtime, ctime) = os.stat("dosya.py")
# bu çok tercih edilmez. bir de daha karışık
####### ya da #########
a = os.path.getmtime("foo.py")
print type(a) # float
# 1340619312.918 gibi bir float sayı verir. Bunu okunabilir hale getirmek için time modülündeki ctime metodu kullanılabilir.
@baybatu
baybatu / tomcat_killer.sh
Last active December 15, 2015 05:27
Kill tomcat from terminal easily
#!/bin/bash
ps -A | grep tomcat | awk '$4 !~ /grep/ {print $1}' | xargs kill -9
@baybatu
baybatu / logback-logger-off.md
Created November 8, 2015 16:55
Stopping Logging For All Levels In Logback

When you need to tell Logback to stop logging for a logger, the following snippet can be added to logback.xml configuration file:

<logger name="loggerName">
    <level value="off" />
</logger>

"loggerName" represents your logger name that will be stopped.

@baybatu
baybatu / pkg_resources-DistributionNotFound-six.md
Created November 8, 2015 16:56
A Solution For 'pkg_resources.DistributionNotFound six' Problem

Today i have decided to write some unit test on JavaScript via Jasmine, but i encountered the following exception stack trace.

Traceback (most recent call last):
  File "/usr/local/bin/jasmine", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2603, in <module>
    working_set.require(__requires__)
 File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 666, in require
@baybatu
baybatu / maven-war-exclude-directory.md
Last active June 30, 2020 20:31
Excluding Directory From War Package In maven-war-plugin

packagingExcludes configuration tag can be used to exclude certain files or directories from the war file. It is important to put '/' character at the end of the directory to be excluded. If there is no such '/' character, then the entry is interpreted as a regular file.

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <version>2.3</version>
 
@baybatu
baybatu / primefaces-dataexport-column-display-none.md
Last active November 9, 2015 11:49
Hiding Exported Column On DataTable In PrimeFaces

The talented DataExporter component of the PrimeFaces can be used to export data listed in DataTable to various file formats, such as xls, pdf, csv and xml. Also, exportable attribute of column component inside of DataTable, can be used to determine to whether the column is exported to file or not. Well, what if we want to export a column without displaying on DataTable? In this case, we can add:

display: none;
@baybatu
baybatu / get-domain-mapping-in-grails.groovy
Last active May 24, 2020 10:06
Getting mapping from domain class in Grails
class Person {
Long id
String name
static mapping = {
table name: 'PERSON'
id column: 'PRS_ID'
name column: 'PRS_NAME'
}
}
@baybatu
baybatu / attach-listener-to-push-method.js
Last active July 19, 2021 09:44
Attach event listener to Array push method call
var eventify = function(arr, callback) {
arr.push = function(e) {
Array.prototype.push.call(arr, e);
callback(arr);
};
};
var array = [1,2,3];
eventify(array, function(newArray) {
@baybatu
baybatu / logging-urlmappings-in-grails.md
Last active January 10, 2016 22:27
Logging UrlMapping file mapping in Grails

Add following log configuration into log4j block in Config.groovy.

all 'org.codehaus.groovy.grails.web.mapping'