Skip to content

Instantly share code, notes, and snippets.

View ahmadnaser's full-sized avatar

Ahmad Naser ahmadnaser

View GitHub Profile
@ahmadnaser
ahmadnaser / AhmadNaser Responsive WebSite CSS BASE
Created July 23, 2014 10:23
AhmadNaser Responsive WebSite CSS BASE , Desktop , Tablet , Mobile
/*
Theme Name: AhmadNaser Responsive WebSite CSS BASE
Theme URI: http://ahmadnaser.com/
Author: AhmadNaser
*/
/*
=============================================== 01. BASE STYLES (1140px) ===============================================
@ahmadnaser
ahmadnaser / gist:9d11b092477f9415a5b6
Created August 27, 2014 09:39
optimize wordpress performance on the server
wp-config.php ---> define('ENABLE_CACHE', true);
php.ini ---> memory_limit = 6144M
install wp plugin --> w3-total-cache
optimize table in phpmyadmin
@ahmadnaser
ahmadnaser / cpp sample code
Created August 31, 2014 06:28
cpp sample code
#include <string>;
#include <iostream>;
using namespace std;
void ex1 ();
void ex2 ();
void ex3 ();
float Input (float x, float y,char op);
@ahmadnaser
ahmadnaser / handling drop down list in views data from mvc4 action controlelr
Created October 13, 2014 07:14
handling drop down list in views data from mvc4 action controlelr
//1-Define them manually in the view
@Html.DropDownListFor(model => model.Location, new List<SelectListItem>{
new SelectListItem() {Text = "Abu Dhabi", Value="Abu Dhabi"},
new SelectListItem() {Text = "Dubai", Value="Dubai"}
})
//or
//2-Define them in action and gets them in the controller (Recommended)
@ahmadnaser
ahmadnaser / wordpress Flush cache when post is saved
Created October 15, 2014 06:43
wordpress Flush cache when post is saved
/* Flush cache when post is saved */
function clearCache($post_ID) {
if (function_exists('w3tc_pgcache_flush')) {
w3tc_pgcache_flush();
}
return $post_ID;
}
@ahmadnaser
ahmadnaser / google map address using image
Last active August 29, 2015 14:07
address using image
<div data-role="content">
<address>1962 Market St
<br>Denver, CO 80202</address>
<img src="https://maps.googleapis.com/maps/api/staticmap?center=1962%20Market%20St.%20Denver,%20CO&amp;zoom=14&amp;size=288x200&amp;markers=1962%20Market%20St.%20Denver,%20CO&amp;sensor=false" height="200" width="288" />
<a href="index.html" data-role="button" data-icon="home">Home</a>
</div>
var embed2 ="<iframe width='100%' height='400px' frameborder='0' scrolling='no' marginheight='0' marginwidth='0' src='https://maps.google.com/maps?&amp;q="+$lat+","+$lng+"&amp;output=embed&iwloc'></iframe>";
@ahmadnaser
ahmadnaser / how to use github
Last active August 29, 2015 14:08
how to use github
http://msysgit.github.io/
we want use this
https://windows.github.com/
System Environment
Path-->
C:\Users\Sterio007\AppData\Local\GitHub\PortableGit_69703d1db91577f4c666e767a6ca5ec50a48d243\libexec\git-core
@ahmadnaser
ahmadnaser / GCM CURL FROM PHP TO ANDRIUD
Last active August 29, 2015 14:08
GCM CURL FROM PHP TO ANDRIUD
to install curl
http://www.confusedbycode.com/curl/
to make new api service
https://console.developers.google.com/
this is a 401 error
curl --header "Authorization: key=AIzaSyAMbf7mEVV-8n2tELq1l-PAdRr1n0sHxrE" --header Content-Type:"application/json" https://android.googleapis.com/gcm/send -d "{\"registration_ids\":[\"ABC\"]}"
@ahmadnaser
ahmadnaser / wordpress get all the categories from the database
Created December 24, 2014 00:01
wordpress get all the categories from the database
<?php
// get all the categories from the database
/* Loop through each category "team" and output the posts */
@ahmadnaser
ahmadnaser / gist:660c5626ddf77f1ecaad
Created December 29, 2014 07:57
apache rewrite samples
Example1
rewrite specific page by id
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^coupons/(.*)$ /index.php?page_id=87 [L]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f