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 / getDomainName.js
Last active August 1, 2021 13:34
Get complete domain name with protocol and port if available. #js #url From http://stackoverflow.com/questions/6941533/javascript-get-protocol-domain-and-port-from-url
var domain = location.protocol+'//'+location.hostname+(location.port ? ':'+location.port : '');
@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
@tahirm
tahirm / mysqldump.sql
Created March 27, 2014 13:44
mysqldump command to dump a remote database in locally. #db #sql #mysql #mysqldump #remote
mysqldump -u USER -p -h dev.incuray.com DATABASE > /path/to/output/file/DATABASE.sql;
@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
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 / PHP: Email.php
Last active December 17, 2015 13:49
PHP: Email
$aResponse = array('success' => false);
$from = $_POST['email'];
$message = $_POST['msg'];
$subject = $_POST['name'];
// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: ' . $from . "\r\n";
@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

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