Skip to content

Instantly share code, notes, and snippets.

View haroonabbasi's full-sized avatar
💭
always looking out for new tools new libraries

Haroon Abbasi haroonabbasi

💭
always looking out for new tools new libraries
  • Lahore
View GitHub Profile
@haroonabbasi
haroonabbasi / new_gist_file_0
Last active February 12, 2021 11:14
get all files in zip modified between two git commits.
git archive --output=file.zip HEAD $(git diff --name-only SHA1 SHA2)
OR
git diff --name-only SHA1 SHA2 | zip dest.zip -@
@haroonabbasi
haroonabbasi / utils.js
Last active August 29, 2015 14:27 — forked from grantges/utils.js
Utility Library for Appcelerator Titanium
//Shortcuts
var $P = Ti.App.Properties;
var $F = Ti.Filesystem;
// PLATFORM RELATED Functions
exports.osname = Ti.Platform.osname;
exports.iOS = function() { return (Ti.Platform.osname === 'ipad' || Ti.Platform.osname ==='iphone')};
exports.android = function() { return Ti.Platform.osname === 'android' }
@haroonabbasi
haroonabbasi / new_gist_file.sql
Created July 31, 2015 13:43
wordpress migration to localhost quries
UPDATE wp_options SET option_value = replace(option_value, 'http://www.example.com', 'http://localhost/test-site') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET post_content = replace(post_content, 'http://www.example.com', 'http://localhost/test-site');
UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://www.example.com','http://localhost/test-site');
function loadScript(url, callback){
var script = document.createElement("script")
script.type = "text/javascript";
if (script.readyState){ //IE
script.onreadystatechange = function(){
if (script.readyState == "loaded" ||
script.readyState == "complete"){
script.onreadystatechange = null;
@haroonabbasi
haroonabbasi / new_gist_file.md
Created July 13, 2015 16:30
Useful PHP Functions

From Bytes to Size Units

// Snippet from PHP Share: http://www.phpshare.org

    function formatSizeUnits($bytes)
    {
        if ($bytes >= 1073741824)
        {
 $bytes = number_format($bytes / 1073741824, 2) . ' GB';
@haroonabbasi
haroonabbasi / new_gist_file.md
Created July 1, 2015 06:39
Javscript Mobile detect

Using Regex (from detectmobilebrowsers.com):

Here's a function that uses an insanely long and comprehensive regex which returns a true or false value depending on whether or not the user is browsing with a mobile.

window.mobilecheck = function() {
  var check = false;
  (function(a){if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g
@haroonabbasi
haroonabbasi / new_gist_file_0
Created June 22, 2015 19:32
SSL [error] Init: SSLPassPhraseDialog builtin is not supported on Win32.
Problem:
Upon Apache startup with SSL, the log shows the following error:
[error] Init: SSLPassPhraseDialog builtin is not supported on Win32.
The SSLPassPhraseDialog is a directive within the Apache httpd.conf or ssl.conf that is not supported by Windows
Resolution:
  1. Generate you server key
$ openssl genrsa -des3 -out server.key 1024

You will be prompted for a password for your key. Enter, confirm and continue.

  1. Generate your Certificate Signing Request (CSR)
Today, we introduces the importance section in our blog. This section will provide solutions for problems of Shopify. Here is the first the problem.
Issue:
Some clients give feedbacks that they can’t access your apps and they only see the text “loading”
@haroonabbasi
haroonabbasi / new_gist_file.md
Created June 19, 2015 09:35
useful php commands

version

php -v

php location (windows)

where php