Skip to content

Instantly share code, notes, and snippets.

View tahirm's full-sized avatar

Tahir tahirm

  • Zürich, Switzerland
View GitHub Profile
@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"

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 / 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

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 / 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)
@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/
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">