Skip to content

Instantly share code, notes, and snippets.

View ahmadnaser's full-sized avatar

Ahmad Naser ahmadnaser

View GitHub Profile
@ahmadnaser
ahmadnaser / gist:9465555
Created March 10, 2014 14:09
wordpress custom query 2
$eventsresult = $wpdb->get_results( "SELECT wp_posts.*, wp_term_taxonomy.taxonomy,wp_terms.`name`\n".
"FROM wp_posts, wp_term_taxonomy ,wp_terms,wp_term_relationships\n".
"WHERE \n".
" wp_term_taxonomy.term_taxonomy_id = wp_terms.term_id\n".
"and wp_term_relationships.object_id=wp_posts.ID\n".
"and wp_term_relationships.term_taxonomy_id=wp_term_taxonomy.term_taxonomy_id\n".
"and wp_terms.`name`='Movies'\n".
"and wp_posts.post_status = 'publish' \n".
"AND wp_posts.post_type = 'post';" );
@ahmadnaser
ahmadnaser / gist:10117414
Created April 8, 2014 12:33
Cross Domain .htaccess for zend allow cross domain request
<IfModule mod_rewrite.c>
Header set Access-Control-Allow-Headers "X-Requested-With"
Header set Access-Control-Max-Age "60"
Header set Access-Control-Allow-Credentials true
Header set Access-Control-Allow-Origin: "*"
Header set Access-Control-Allow-Headers "Origin, X-Requested-With, Content-Type, Accept,application/json, *"
RewriteEngine on
@ahmadnaser
ahmadnaser / gist:10975310
Created April 17, 2014 11:21
call javascript form actionscript
import flash.external.ExternalInterface;
ExternalInterface.call("dofinish()");
<script type="text/javascript">
function dofinish() {
alert("This function is called from ActionScript!");
}
@ahmadnaser
ahmadnaser / truncate in mssql
Last active August 29, 2015 14:01
truncate in mssql
delete from UserProfile
dbcc checkident('UserProfile',reseed,0)
truncate table webpages_Membership
@ahmadnaser
ahmadnaser / Collapsable Panel bootstrap
Created June 11, 2014 19:25
Collapsable Panel bootstrap
<div class="panel-group" id="accordion">
<div class="panel panel-default" id="panel1">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-target="#collapseOne" href="#collapseOne" class="">
Search Filters
</a>
</h4>
</div><!--./panel-heading-->
@ahmadnaser
ahmadnaser / custom ajax , database insert in php wordpress
Created June 19, 2014 10:38
custom ajax , database insert in php wordpress
<?php // custom Ajax function
add_action( 'wp_footer', 'addvisit_javascript' );
function addvisit_javascript() {
?>
<script type="text/javascript" >
var thestartercounter=0;
@ahmadnaser
ahmadnaser / html regular expression in wordpress
Created June 23, 2014 10:31
html regular expression in wordpress
Rating form has been successfully updated. <span class="rating-result "><span class="star-rating" style="color: #FDC709"><i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star-half-o"></i></span><span class="star-result">4.45/5</span></span>
/*Update Avg Rating On Update
* @Author :AhmadHammad
*
* Steps : 1-Update The Current Rating Indicators
* 2-Get The Html for the overall result
* 3-Parse it and get the rating from 5 . e.g 4.5
* */
@ahmadnaser
ahmadnaser / logout from wordpress without confirmaiton
Created July 2, 2014 11:20
logout from wordpress without confirmaiton
//logout from wordpress without confirmaiton
ob_start();
wp_loginout(get_permalink());
$loginoutlink = ob_get_contents();
ob_end_clean();
var logout_content4='<li id="" class="menu-item menu-item-type-post_type menu-item-object-page">'+
'<?php echo $loginoutlink;?></li>';
@ahmadnaser
ahmadnaser / Match any part of id in jquery
Created July 3, 2014 13:25
Match any part of id in jquery
$('#InsuranceCompany, input[id^="InsuranceCompany-"]').typeahead(typeahead.data);
<input type="text" class="upme-input tt-query" name="InsuranceCompany-2" id="InsuranceCompany-2" value="" />
<input type="text" class="upme-input tt-query" name="InsuranceCompany-2" id="InsuranceCompany-24" value="" />
@ahmadnaser
ahmadnaser / Script To Execute Javascript after ajax loaded html
Created July 17, 2014 09:24
Script To Execute Javascript after ajax loaded html
//By Ahmadnaser , get the content and execute the script in it
//console.log(output);
$('#' + AAPL_content).find("script").each(function(i) {
eval($(this).text());
});