Skip to content

Instantly share code, notes, and snippets.

View anova's full-sized avatar

Necat Bolpaça anova

View GitHub Profile
@anova
anova / parallel-loading-for-css.js
Created December 12, 2012 23:52
Parallel loading for css files. I need this for font embedding css files.
//this script is inline for avoid extra request.
var fonts = new Array();
fonts.push('css/font/pfsquaresanspromedium.css');
fonts.push('css/font/pfhighwaysanspro-thin.css');
fonts.push('css/font/ubuntu-m.css');
fonts.push('css/font/pfhighwaysanspro-regular-light-italic.css');
fonts.push('css/font/pfsquaresanspro-italic-regular.css');
var head = document.getElementsByTagName('head')[0];
var link = document.getElementsByTagName('link')[0];
for(var i in fonts) {
@anova
anova / web.config
Created March 8, 2013 09:49
php 5.3 for kriweb
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<handlers>
<remove name="PHP" />
<add name="PHP cgi" path="*.php" verb="*" modules="FastCgiModule" scriptProcessor="C:\kwdata\php5.3\php-cgi.exe" resourceType="Unspecified" />
</handlers>
<httpErrors errorMode="Detailed" />
<asp scriptErrorSentToBrowser="true"/>
<validation validateIntegratedModeConfiguration="false"/>
@anova
anova / e_mail_valid.js
Created March 26, 2013 16:28
Basic e-mail validation for input.
function e_mail_valid(email) {
var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
return reg.test(email);
}
@anova
anova / wp-query-for-custom-taxonomy.php
Created May 29, 2013 11:36
Hatırlatma : WP_Query için taxonomy bazlı sorgu yaparken "taxonomy_adi=$kategori_slug_ismi" olarak sorgu yapılmalıdır. Note : Use "taxonomy_name=$category_slug_name" for WP_Query queries.
<?php
$query_parameters = "post_type=portfolio&posts_per_page=-1&orderby=$portfolio_order&order=DESC&portfolio_category=$post_name";
$portfolio = new WP_Query($query_parameters);
while ( $portfolio->have_posts() ) : $portfolio->the_post();
//loop content
endwhile;
@anova
anova / swiftmailer-kriweb.php
Created June 4, 2013 14:14
Send an e-mail via kriweb with swiftmailer. (This must work with other hostings) **requires php 5.2
<?php
//requires swiftmailer -> http://swiftmailer.org/
include dirname(__FILE__) . '/vendor/swiftmailer/swift_required.php';
/* values : begin */
$sender_e_mail = 'sender@example.com';
$sender_password = 'password';
$sender_name = 'Example Sender';
$subject = 'My Example Subject';
<?php
function rgicgier_pagination($query = null) {
if ( !$query ) {
global $wp_query;
$query = $wp_query;
}
$big = 999999999; // need an unlikely integer
$pagination = paginate_links( array(
@anova
anova / web.config
Created June 30, 2013 20:55
Windows IIS woff & svg support. Note : <handlers> section is "kriweb" (a hosting company) spesific.
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<handlers>
<remove name="PHP" />
<add name="PHP cgi" path="*.php" verb="*" modules="FastCgiModule" scriptProcessor="C:\kwdata\php5.3\php-cgi.exe" resourceType="Unspecified" />
</handlers>
<httpErrors errorMode="Detailed" />
<asp scriptErrorSentToBrowser="true"/>
<validation validateIntegratedModeConfiguration="false"/>
@anova
anova / wordpress-search-only-in-category.php
Created July 13, 2013 13:48
Wordpress search only in specific categories.
<?php
wp_reset_query();
//http://wordpress.org/support/topic/search-one-category-only
global $wp_query;
$category_sub_1 = get_category_by_path('main-category/sub-category-1');
$category_sub_2 = get_category_by_path('main-category/sub-category-2');
if(is_search()):
$cat = array(
@anova
anova / .htaccess
Created July 24, 2013 07:22
.htaccess for www enforcement and wordpress. (helicon)
# BEGIN WordPress
RewriteEngine on
RewriteBase /
#enforce www
#http://stackoverflow.com/a/4958847/181295
RewriteCond %{HTTP_HOST} !^$
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTPS}s ^on(s)|
RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]