Skip to content

Instantly share code, notes, and snippets.

View anova's full-sized avatar

Necat Bolpaça anova

View GitHub Profile
@anova
anova / phptal-conditional.html
Created September 18, 2013 06:51
phptal multiple if priority issue solved with brackets.
<h1 tal:attributes="class php:repeat.current_item.number == 1 ? 'one'
: (repeat.current_item.number == 2 ? 'two'
: (repeat.current_item.number == 3 ? 'three' : NULL))"
tal:content="repeat/current_item/number"
tal:repeat="repeat_item collection"></h1>
<!-- collection bind from php code -->
@anova
anova / grayscale.css
Created September 30, 2013 06:30
Grayscale with Css
/* http://jsfiddle.net/KDtAX/487/ */
img.grayscale {
filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#grayscale"); /* Firefox 10+ */
filter: gray; /* IE6-9 */
-webkit-filter: grayscale(100%); /* Chrome 19+ & Safari 6+ */
-webkit-transition: all .6s ease; /* Fade to color for Chrome and Safari */
-webkit-backface-visibility: hidden; /* Fix for transition flickering */
}
.transparent {
background: transparent url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7) repeat;
}
@anova
anova / strtoupper-turkish.php
Created October 1, 2013 08:45
strtoupper Turkish
<?php
//strtoupper turkish
function strtoupper_tr($input) {
return str_replace(
array('a','b','c','ç','d','e','f','g','ğ','h','ı','i','j','k','l','m','n','o','ö','p','r','s','ş','t','u','ü','v','y','z','q','w','x'),
array('A','B','C','Ç','D','E','F','G','Ğ','H','I','İ','J','K','L','M','N','O','Ö','P','R','S','Ş','T','U','Ü','V','Y','Z','Q','W','X'),
$input);
}
?>
@anova
anova / ie-edge-turn-off-compatibility.txt
Created October 8, 2013 05:56
IE=Edge, turn off compatibility mode with server-side header.
header('X-UA-Compatible', 'IE=Edge'); /*for php*/
Response.AddHeader("X-UA-Compatible", "IE=Edge"); /* for asp.net c# */
@anova
anova / show-warning-message-ie7.html
Created October 8, 2013 13:03
Show a warning message who uses IE 7 or lower.
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Show a warning message if user visiting with IE 7</title>
</head>
<body>
<!--[if lt IE 8]>
<p>Warning message for who uses IE 7.</p>
<![endif]-->
@anova
anova / turkish-capitalize-words.js
Last active June 28, 2022 08:45
Capitalize, lowercase, uppercase for Turkish alphabet.
//http://stackoverflow.com/a/1026087/181295
String.prototype.turkishUpperCase = function () {
return this.replace(/ğ/g, 'Ğ')
.replace(/ü/g, 'Ü')
.replace(/ş/g, 'Ş')
.replace(/ı/g, 'I')
.replace(/i/g, 'İ')
.replace(/ö/g, 'Ö')
.replace(/ç/g, 'Ç')
.toUpperCase();
@anova
anova / footer-at-bottom.html
Created October 12, 2013 09:15
Footer must stay at bottom always. From Adem İlter's: http://ademilter.com/sen-hep-en-altta-kal-footer/
@anova
anova / array-in-string.php
Created October 31, 2013 10:27
Access array in double quoted strings. (from php manual comments)
<?php
$test = array(
'test' => 'I can access arrays and objects in curly braces.',
);
echo "This is a test : {$test['test']}";
?>
@anova
anova / angularjs-no-verbatim.js
Created December 2, 2013 09:49
tacir.net te {% verbatim %} {% endverbatim %} kapalı olduğu için angular.js bind taglarını değiştirmek.
var app = angular.module('app', []).config(['$interpolateProvider', function ($interpolateProvider) {
$interpolateProvider.startSymbol('[[');
$interpolateProvider.endSymbol(']]');
}]);
/*
use:
<div ng-app="app">
<div ng-controller="ControllerCtrl as app">
<ul>
<li ng-repeat="item in app.items">