Skip to content

Instantly share code, notes, and snippets.

View irazasyed's full-sized avatar
🎯
WIP

Irfaq Syed irazasyed

🎯
WIP
View GitHub Profile
@irazasyed
irazasyed / currentUrl.php
Created February 3, 2014 03:23
PHP: Get current page URL.
<?php
define('DOMAIN', (strtolower(getenv('HTTPS')) == 'on' ? 'https' : 'http') . '://' . getenv('HTTP_HOST') . (($p = getenv('SERVER_PORT')) != 80 AND $p != 443 ? ":$p" : ''));
define('PATH', parse_url(getenv('REQUEST_URI'), PHP_URL_PATH));
define('CURRENT_URL', DOMAIN . PATH);
@irazasyed
irazasyed / jquery-multi-ajax-handling.js
Created February 14, 2014 00:19
JS: jQuery Multi-AJAX Handling
$.when(
// Get the HTML
$.get("/feature/"),
// Get the CSS
$.get("/assets/feature.css"),
// Get the JS
$.getScript("/assets/feature.js")
@irazasyed
irazasyed / centmin-mod-installation.md
Last active August 29, 2015 13:57
How-To: Install LEMP on CentOS 6.5 x64 using Centmin Mod - http://centminmod.com/download.html

How To Install Linux, NginX, MariaDB, PHP5 (LEMP) stack on CentOS 6.5 x64 using Centmin Mod

Quick start


For this tut, You'll need a VPS or dedicated server with full root user + SSH2 telnet access to install Centmin Mod (For LEMP installation and Management). I'll be using a 1GB memory VPS from DigitalOcean as they got Cheap VPS hosting which are awesome!

In this tut, We'll be setting up latest version of NginX, MariaDB, PageSpeed and PHP.

@irazasyed
irazasyed / fix_fp.sh
Last active August 29, 2015 13:59
Shell: Fix File permissions WordPress
#!/bin/bash
#######################################
## FIX FILE PERMISSIONS FOR WP SETUP ##
#######################################
find ./public -type d -exec chmod 755 {} \;
find ./public -type f -exec chmod 644 {} \;
chown -R nginx:nginx public
@irazasyed
irazasyed / jquery-main.js
Last active August 29, 2015 14:00
jQuery: Load jquery properly within the context of WordPress-targeted JavaScript without using noConflict.
// remap jQuery to $
(function($){
"use strict";
/* trigger when page is ready */
$(document).ready(function (){
// your functions go here
});

This is my script for handling unsolicited sales calls. I can tell by the caller id as they usually come in on our second (unpublished) phone number.

Tips

  • _for best effect… leave off ‘Thank’ to make it sound like the tape already started…

The Script

Thank you for calling Planet Argon. If you know your party’s extension, please say or enter it followed by the pound key.

@irazasyed
irazasyed / keybase.md
Created August 9, 2015 13:30
Keybase

Keybase proof

I hereby claim:

  • I am irazasyed on github.
  • I am irazasyed (https://keybase.io/irazasyed) on keybase.
  • I have a public key whose fingerprint is EDD2 641F 4759 31FD 3E86 DCBC A5B1 D2F5 0417 EF74

To claim this, I am signing this object:

@irazasyed
irazasyed / browser detect
Created November 21, 2012 17:42 — forked from sanooj/browser detect
jQuery: Browser Detect for html
$(document).ready(function()
{
if ( $.browser.msie ){
if($.browser.version == '6.0')
{ $('html').addClass('ie6');
}
else if($.browser.version == '7.0')
{ $('html').addClass('ie7');
}
else if($.browser.version == '8.0')
@irazasyed
irazasyed / gist:4178136
Created November 30, 2012 19:54
JavaScript: Get Current URL
// Get current URL but without the filename.
var currentUrl = window.location.href;
currentUrl = currentUrl.substring(0, currentUrl.lastIndexOf('/')+1);
@irazasyed
irazasyed / gist:4241706
Created December 8, 2012 20:08
JavaScript: Function - inArray Snippet.
function inArray(needle, haystack) {
var length = haystack.length;
for(var i = 0; i < length; i++) {
if(haystack[i] == needle) return true;
}
return false;
}