Skip to content

Instantly share code, notes, and snippets.

View tahirm's full-sized avatar

Tahir tahirm

  • Zürich, Switzerland
View GitHub Profile
INSTALL SYMFONY APP IN A SUBFOLDER OF AN EXISTING SITE
http://www.yegods.it/2015/01/30/install-symfony-app-in-a-subfolder-of-an-existing-site/
Here a solution using virtual host Alias:
<VirtualHost *:80>
DocumentRoot "/var/www/html/vhosts/example.com/public_html"
ServerName www.example.com
<Directory "/var/www/html/vhosts/example.com/public_html">
@tahirm
tahirm / .htaccess
Last active August 29, 2015 14:16 — forked from nab8/.htaccess
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
@tahirm
tahirm / regex-and
Created February 5, 2015 16:40
Regex AND functionality. #regex #and Reference: http://stackoverflow.com/questions/3041320/regex-and-operator
String: foobaz
Regex: (?=.*foo)(?=.*baz)

Make it real

Ideas are cheap. Make a prototype, sketch a CLI session, draw a wireframe. Discussions around concrete examples, not handy-waving abstractions. Don't say you did something, provide a URL that proves it.

Ship it

Nothing is real until it's being used by a real user. This doesn't mean you make a prototype in the morning and blog about it in the evening. It means you find one person you believe your product will help and try to get them to use it.

Do it with style

@tahirm
tahirm / new_gist_file_0
Created September 12, 2014 09:00
Debug php application on remote server through ssh tunnel with xdebug and netbeans. #xdebug #netbeans #ssh http://www.davidlaing.com/2012/07/29/howto-configure-netbeans-php-debugging-for-a-remote-server-over-a-ssh-tunnel/
1. apt-get install php5-xdebug
2. vi /etc/php5/apache2/conf.d/xdebug.ini
3.
zend_extension=/usr/lib/php5/20090626/xdebug.so
xdebug.remote_enable=On
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
4. restart apache2

Launch Sublime Text 2 from the Mac OS X Terminal

Sublime Text 2 ships with a CLI called subl (why not "sublime", go figure). This utility is hidden in the following folder (assuming you installed Sublime in /Applications like normal folk. If this following line opens Sublime Text for you, then bingo, you're ready.

open /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl

You can find more (official) details about subl here: http://www.sublimetext.com/docs/2/osx_command_line.html

Installation

@tahirm
tahirm / uri.js
Created May 16, 2014 14:51 — forked from jlong/uri.js
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@tahirm
tahirm / trim.js
Created May 15, 2014 12:46
Trim function for strings. If native .trim is available it uses that otherwise trim the string manually. #js #trim #string
//trim string
function trim(str){
return String.prototype.trim ? str.trim() : String(str).replace(/^([\s]*)|([\s]*)$/g, '');
}
@tahirm
tahirm / xdebug.sh
Created April 18, 2014 19:42
Install/uninstall xdebug from pecl. #xdebug #apache2 Further notes for installing xdebug on ubuntu. http://ubuntuforums.org/showthread.php?t=525257
# install xdebug using pecl
$ sudo pecl install xdebug
# uninstall xdebug using pecl
$ sudo pecl uninstall xdebug
@tahirm
tahirm / compress-pdf.sh
Created April 17, 2014 21:18
Compress PDF files in linux. #pdf #linux #compress From http://askubuntu.com/questions/113544/how-to-reduce-pdf-filesize
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf
#Leave out the '-dPDFSETTINGS=/screen' setting for better quality, but slightly larger pdfs.