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
def get_score(word1, word2): | |
shared_chars = [char for char in word1.lower() if char in word2.lower()] | |
return len(shared_chars) | |
# Usage | |
get_score('murat', 'burak') | |
# > 3 |
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
/** | |
* @ngdoc directive | |
* @name safe.directive:incomplete-confirmation | |
* | |
* @element ANY | |
* | |
* @description | |
* | |
* `name` attribute'u olan bütün form elementlerinde çalışarak | |
* üzerinde değişiklik yapılmış ancak kaydedilmemiş bir form olduğunda |
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
/** | |
* @ngdoc directive | |
* @name safe.directive:checkboxAll | |
* | |
* @element input | |
* | |
* @description | |
* | |
* Bir listedeki tüm elemanları seçen bir checkbox kutusu yapmak için pratik bir directive. | |
* |
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
/** | |
* 0 User must enter a digit (0 to 9). | |
* 9 User can enter a digit (0 to 9). | |
* # User can enter a digit, space, plus or minus sign. If skipped, enters a blank space. | |
* L User must enter a letter. | |
* ? User can enter a letter. | |
* A User must enter a letter or a digit. | |
* a User can enter a letter or a digit. | |
* & User must enter either a character or a space. | |
* C User can enter characters or spaces. |
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
/** | |
* @ngdoc directive | |
* @name ng.directive:translate | |
* | |
* @element ANY | |
* | |
* @description | |
* | |
* Angular icin ceviri directive'i | |
* |
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
var date1 = new Date(2010, 6, 17); | |
var date2 = new Date(2013, 12, 18); | |
var diff = new Date(date2.getTime() - date1.getTime()); | |
// diff is: Thu Jul 05 1973 04:00:00 GMT+0300 (EEST) | |
console.log(diff.getUTCFullYear() - 1970); // Gives difference as year | |
// 3 | |
console.log(diff.getUTCMonth()); // Gives month count of difference | |
// 6 |
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
var fs = require('fs'); | |
module.exports = function (urlRoot, pathRoot) { | |
pathRoot = pathRoot.replace(urlRoot, ''); | |
return function(req, res, next){ | |
if (req.url.indexOf(urlRoot) === 0) { | |
// Ignore querystrings | |
url = req.url.split('?')[0]; |
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
var fs = require('fs'), | |
url = require('url'); | |
module.exports = function (rootDir, indexFile) { | |
indexFile = indexFile || "index.html"; | |
return function(req, res, next){ | |
var path = url.parse(req.url).pathname; | |
fs.readFile('./' + rootDir + path, function(err, buf){ |
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
/** | |
* Metni url'de kullanılabilir hale çevirir. Boşluklar tireye çevrilir, | |
* alfanumerik olmayan katakterler silinir. | |
* | |
* Transform text into a URL path slug(with Turkish support). | |
* Spaces turned into dashes, remove non alnum | |
* | |
* @param string text | |
*/ | |
slugify = function(text) { |
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
$('#header li a.clickable').click(function); |