<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Coding Snippets</title>
	<atom:link href="http://codingsnippets.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://codingsnippets.com</link>
	<description>Random Code Snippets</description>
	<lastBuildDate>Fri, 16 Mar 2012 17:09:25 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Delete all files matching a pattern within a directory recursively</title>
		<link>http://codingsnippets.com/delete-all-files-matching-a-pattern-within-a-directory-recursively/</link>
		<comments>http://codingsnippets.com/delete-all-files-matching-a-pattern-within-a-directory-recursively/#comments</comments>
		<pubDate>Fri, 16 Mar 2012 17:09:25 +0000</pubDate>
		<dc:creator>jjaramillo</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://codingsnippets.com/?p=142</guid>
		<description><![CDATA[find . &#124; grep -r -e &#8220;SomeFilePrefix.*\.php&#8221; &#124; xargs rm]]></description>
			<content:encoded><![CDATA[<p>find . | grep -r -e &#8220;SomeFilePrefix.*\.php&#8221; | xargs rm</p>
]]></content:encoded>
			<wfw:commentRss>http://codingsnippets.com/delete-all-files-matching-a-pattern-within-a-directory-recursively/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>yet another ~./vimrc</title>
		<link>http://codingsnippets.com/yet-another-vimrc/</link>
		<comments>http://codingsnippets.com/yet-another-vimrc/#comments</comments>
		<pubDate>Tue, 28 Feb 2012 19:18:50 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Vim]]></category>

		<guid isPermaLink="false">http://codingsnippets.com/?p=130</guid>
		<description><![CDATA[set tabstop=4 softtabstop=4 shiftwidth=4 noexpandtab number nnoremap &#60;F7&#62; :tabp&#60;Enter&#62; nnoremap &#60;F8&#62; :tabn&#60;Enter&#62; nnoremap &#60;F6&#62; :bd&#60;Enter&#62; nnoremap &#60;F5&#62; :tabnew&#60;Enter&#62; set sessionoptions=blank,buffers,curdir,folds,globals,help,localoptions,options,resize,tabpages,winsize,winpos Create Session: :mksession /path/to/session/file.vim Restore Session: $ vim -S /path/to/session/file.vim http://code.google.com/p/conque/ :source %]]></description>
			<content:encoded><![CDATA[<pre>
set tabstop=4 softtabstop=4 shiftwidth=4 noexpandtab number
nnoremap &lt;F7&gt; :tabp&lt;Enter&gt;
nnoremap &lt;F8&gt; :tabn&lt;Enter&gt;
nnoremap &lt;F6&gt; :bd&lt;Enter&gt;
nnoremap &lt;F5&gt; :tabnew&lt;Enter&gt;

set sessionoptions=blank,buffers,curdir,folds,globals,help,localoptions,options,resize,tabpages,winsize,winpos

Create Session:
:mksession /path/to/session/file.vim

Restore Session:
$ vim -S /path/to/session/file.vim

http://code.google.com/p/conque/

:source %
</pre>
]]></content:encoded>
			<wfw:commentRss>http://codingsnippets.com/yet-another-vimrc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mount remote system locally over ssh</title>
		<link>http://codingsnippets.com/mount-remote-system-locally-over-ssh/</link>
		<comments>http://codingsnippets.com/mount-remote-system-locally-over-ssh/#comments</comments>
		<pubDate>Tue, 28 Feb 2012 17:55:33 +0000</pubDate>
		<dc:creator>jjaramillo</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://codingsnippets.com/?p=126</guid>
		<description><![CDATA[with certificate authentication or password prompt sshfs my_username@example.com:/home/my_user /mnt/my_remote_system  -o reconnect -o follow_symlinks -o allow_other &#160; or with plain text password: echo &#8220;my_password&#8221; &#124; sshfs my_username@example.com:/home/my_user /mnt/my_remote_system  -o reconnect -o follow_symlinks -o allow_other -o password_stdin]]></description>
			<content:encoded><![CDATA[<p>with certificate authentication or password prompt<br />
sshfs my_username@example.com:/home/my_user /mnt/my_remote_system  -o reconnect -o follow_symlinks -o allow_other</p>
<p>&nbsp;</p>
<p>or with plain text password:</p>
<p>echo &#8220;my_password&#8221; | sshfs my_username@example.com:/home/my_user /mnt/my_remote_system  -o reconnect -o follow_symlinks -o allow_other -o password_stdin</p>
]]></content:encoded>
			<wfw:commentRss>http://codingsnippets.com/mount-remote-system-locally-over-ssh/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Possible interview questions for a Senior PHP Web Developer</title>
		<link>http://codingsnippets.com/possible-interview-questions-for-a-senior-php-web-developer/</link>
		<comments>http://codingsnippets.com/possible-interview-questions-for-a-senior-php-web-developer/#comments</comments>
		<pubDate>Thu, 15 Dec 2011 21:45:23 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://codingsnippets.com/?p=122</guid>
		<description><![CDATA[Below is just an informal list of possible questions to ask a more advanced PHP web developer. Please feel free to add more. dns port? SSL port? what does the linux command dd do? what does the linux command df do? how many bits is an IPV6 address? how many bits is an IPV4 address? [...]]]></description>
			<content:encoded><![CDATA[<pre>Below is just an informal list of possible questions to ask a more advanced PHP web developer. Please feel free to add more.</pre>
<pre>dns port?
SSL port?
what does the linux command dd do?
what does the linux command df do?
how many bits is an IPV6 address?
how many bits is an IPV4 address?
what's a factory?
what's a fascade? can you please give an example of when you would use one?
can you please explain, in simple terms using the whiteboard if necessary, what a reverse proxy is?
what are the four contexts in an nginx configuration file?
what git command would I use to remove all untracked files, ignored files and modified changes?
what git command would I use to update all submodules referenced in a project?
in php, please give two examples of methods that can be used to compensate for multiple inheritence
what is dependency injection? why would it be used? what are its advantages and disadvantages?
please explain to us, in simple terms, what a IP bit mask is
what are four http headers used for caching?
can you name some alternative methods for caching?
can you please explain to me, as if I were an intermediate programmer, some of the gotchas of developing for web applications with more than one web server?

what is your preferred php library for image manipulation?
have you ever configured a load balancer?
have you ever written a php extension?
how many times have you compiled php from scratch?
how you used redis? can you explain what redis is and when you'd use it?
how familiar are you with web analytics?
can you please write a regular expression for me that will match a string starting at the beginning of the line, followed by five numeric digit, followed by any number whitespace characters, followed by a hyphen, followed by any number of whitespace characters and capturing the rest of the content of the line in a capturing group?
</pre>
]]></content:encoded>
			<wfw:commentRss>http://codingsnippets.com/possible-interview-questions-for-a-senior-php-web-developer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Drop Column If Exists in MySQL</title>
		<link>http://codingsnippets.com/drop-column-if-exists-in-mysql/</link>
		<comments>http://codingsnippets.com/drop-column-if-exists-in-mysql/#comments</comments>
		<pubDate>Mon, 29 Aug 2011 21:52:51 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://codingsnippets.com/?p=119</guid>
		<description><![CDATA[IF EXISTS ( SELECT * FROM information_schema.columns WHERE table_name = 'country' AND column_name = 'created_at' AND table_schema = DATABASE() ) THEN ALTER TABLE `country` DROP COLUMN `created_at`; END IF; Because DROP COLUMN IF EXISTS isn't supported by MySQL.]]></description>
			<content:encoded><![CDATA[<pre>IF EXISTS ( SELECT * FROM information_schema.columns WHERE table_name = 'country' AND column_name = 'created_at' AND table_schema = DATABASE() ) THEN
    ALTER TABLE `country` DROP COLUMN `created_at`;
END IF;</pre>
<pre>Because DROP COLUMN IF EXISTS isn't supported by MySQL.</pre>
]]></content:encoded>
			<wfw:commentRss>http://codingsnippets.com/drop-column-if-exists-in-mysql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Show All Columns on a MySQL Table</title>
		<link>http://codingsnippets.com/show-all-columns-on-a-mysql-table/</link>
		<comments>http://codingsnippets.com/show-all-columns-on-a-mysql-table/#comments</comments>
		<pubDate>Mon, 29 Aug 2011 21:45:29 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://codingsnippets.com/?p=116</guid>
		<description><![CDATA[SELECT * FROM information_schema.columns WHERE table_name = &#8216;my_super_table_name&#8217; AND table_schema = &#8216;my_super_database_name&#8217;;]]></description>
			<content:encoded><![CDATA[<p>SELECT * FROM information_schema.columns WHERE table_name = &#8216;my_super_table_name&#8217; AND table_schema = &#8216;my_super_database_name&#8217;;</p>
]]></content:encoded>
			<wfw:commentRss>http://codingsnippets.com/show-all-columns-on-a-mysql-table/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Show All Indexes on a MySQL Database</title>
		<link>http://codingsnippets.com/show-all-indexes-on-a-mysql-database/</link>
		<comments>http://codingsnippets.com/show-all-indexes-on-a-mysql-database/#comments</comments>
		<pubDate>Mon, 29 Aug 2011 21:41:01 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://codingsnippets.com/?p=109</guid>
		<description><![CDATA[SELECT TABLE_NAME, INDEX_NAME, COLUMN_NAME, CARDINALITY, INDEX_TYPE FROM information_schema.statistics WHERE INDEX_NAME != &#8216;PRIMARY&#8217; AND table_schema = &#8216;my_super_database&#8217;;]]></description>
			<content:encoded><![CDATA[<p>SELECT TABLE_NAME, INDEX_NAME, COLUMN_NAME, CARDINALITY, INDEX_TYPE FROM information_schema.statistics WHERE INDEX_NAME != &#8216;PRIMARY&#8217; AND table_schema = &#8216;my_super_database&#8217;;</p>
]]></content:encoded>
			<wfw:commentRss>http://codingsnippets.com/show-all-indexes-on-a-mysql-database/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting Started with Git</title>
		<link>http://codingsnippets.com/getting-started-with-git/</link>
		<comments>http://codingsnippets.com/getting-started-with-git/#comments</comments>
		<pubDate>Wed, 27 Jul 2011 21:14:29 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Git]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://codingsnippets.com/?p=89</guid>
		<description><![CDATA[Below are some helpful links and tips for getting started with the Git version control system. Git is rapidly becoming one of the most widely used version control systems is use today. Git is especially is open source projects as it allows for rapid merging: a feature not found in most version control systems. Git [...]]]></description>
			<content:encoded><![CDATA[<p>Below are some helpful links and tips for getting started with the Git version control system.</p>
<p>Git is rapidly becoming one of the most widely used version control systems is use today. Git is especially is open source projects as it allows for rapid merging: a feature not found in most version control systems. Git is also compact and FAST.</p>
<p>If you&#8217;re a developer, I encourage you to write open source software as a means of deliberate practice. Using Git in the context of open source will really help other contribute and use your work. I recommend github.com specifically. Even professionally, I think that Git&#8217;s market share will continue to rise and be more prevalent in the workplace.</p>
<p>After using subversion for years, I dropped it in favour of Git. And below are a few notes that I learned along the way that may make it easier for you to get started. I hope you find using as fun as I do.</p>
<h2>Introduction</h2>
<p>Here&#8217;s an excellent intro video. You should probably watch this first. There are two parts. <a title="http://excess.org/article/2008/07/ogre-git-tutorial/" href="http://excess.org/article/2008/07/ogre-git-tutorial/">http://excess.org/article/2008/07/ogre-git-tutorial/</a></p>
<p>&nbsp;<br />
Here&#8217;s a nice, short book on how GIT works. You may want to come back to this after you&#8217;ve played with the commands for a couple of days. But I do recommend coming back to it. It has lot of explanations that show <em>how</em> git works. I personally read this first. After reading it, I had a great grasp of the concepts which made it easier to memorize the commands.<br />
<a href="http://peepcode.com/products/git-internals-pdf" target="_blank">http://peepcode.com/products/git-internals-pdf</a></p>
<p>//see my git links on my delicious account (note: there are 3 pages; some of the more useful ones are older links; the newer links are more advanced items, so you may want to skip them for now)<br />
<a href="http://www.delicious.com/homer6/git">http://www.delicious.com/homer6/git</a></p>
<p>//Install Git on Ubuntu<br />
sudo apt-get install git-core</p>
<p>&nbsp;</p>
<h2>Finding the Usage</h2>
<p>//Run: git &lt;command&gt; &#8211;help to see usage on that command<br />
//eg. git push &#8211;help</p>
<h2>Some Common Commands</h2>
<p>git clone -o github_remote https://github.com/jquery/jquery.git</p>
<p>git pull github_remote</p>
<p>git push github_remote github_branch_master</p>
<p>git push &#8211;all github_remote</p>
<p>git status</p>
<p>git commit -a -m &#8220;Fixed error with homepage not displaying the correct timezone.&#8221;</p>
<p>git add -i</p>
<p>&nbsp;</p>
<p>//warning: destructive (like an svn revert); know what you&#8217;re doing first with this.</p>
<p>git reset &#8211;hard master</p>
<p>//add this bash alias to your ~/.bashrc file to be able to recursively add empty directories to a repository</p>
<p>alias git_add_empty_dirs=&#8217;find . \( -type d -empty \) -and \( -not -regex ./\.git.* \) -exec touch {}/.gitignore \;&#8217;</p>
<p>//turns on the shell colors for all working copies</p>
<p>git config &#8211;global color.ui always</p>
<p>//makes git status = git st</p>
<p>git config &#8211;global alias.st status</p>
<p>//create an alias to easily recursively update the submodules within a project</p>
<p>git config &#8211;global alias.subup &#8220;submodule update &#8211;init &#8211;recursive&#8221;</p>
<h2>More Useful Git Resources</h2>
<p><a href="http://progit.org/book/">http://progit.org/book/</a></p>
<p>For people who have used SVN:<br />
<a href="http://git.or.cz/course/svn.html"> http://git.or.cz/course/svn.html</a></p>
<p>A Simple Workflow for using GIT in small teams<br />
<a href="http://toroid.org/ams/git-central-repo-howto"> http://toroid.org/ams/git-central-repo-howto</a></p>
<p>Also, the git official website has a lot of resources&#8230;<br />
<a href="http://git-scm.com/"> http://git-scm.com/</a></p>
<p>Here&#8217;s a great article on rebasing:<br />
<a title="http://www.randyfay.com/node/91" href="http://www.randyfay.com/node/91"> http://www.randyfay.com/node/91</a></p>
]]></content:encoded>
			<wfw:commentRss>http://codingsnippets.com/getting-started-with-git/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Create your own linux/mysql/php development box for Windows or Mac OS X</title>
		<link>http://codingsnippets.com/create-your-own-linuxmysqlphp-development-box-for-windows-or-mac-os-x/</link>
		<comments>http://codingsnippets.com/create-your-own-linuxmysqlphp-development-box-for-windows-or-mac-os-x/#comments</comments>
		<pubDate>Mon, 11 Jul 2011 17:30:30 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[Git]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://codingsnippets.com/?p=81</guid>
		<description><![CDATA[Download iso of ubuntu server edition 11 http://www.ubuntu.com/download/server/download Download VirtualBox http://www.virtualbox.org/wiki/Downloads Install VirtualBox Create a new VM with 1000mb ram and 20GB of storage - bridge the network connection - default install (enable openssh server) $ sudo su - $ visudo $ vim /etc/network/interfaces auto eth0 iface eth0 inet static address 192.168.7.55 netmask 255.255.255.0 gateway [...]]]></description>
			<content:encoded><![CDATA[<pre>
Download iso of ubuntu server edition 11

http://www.ubuntu.com/download/server/download

Download VirtualBox

http://www.virtualbox.org/wiki/Downloads

Install VirtualBox

Create a new VM with 1000mb ram and 20GB of storage
	- bridge the network connection
	- default install (enable openssh server)

$ sudo su -
$ visudo
$ vim /etc/network/interfaces
	auto eth0
	iface eth0 inet static
			address 192.168.7.55
			netmask 255.255.255.0
			gateway 192.168.7.1

$ /etc/init.d/networking restart
$ ifconfig
$ ping google.com  //confirms internet connectivity
$ apt-get update  //update package manager sources
$ apt-get install mysql-server  //install mysql
$ apt-get install apache2
$ apt-get install php5
$ php -v  //confirm php 5.3.5
$ apt-get install samba  //install samba
$ vim /etc/samba/smb.conf
	- enable (uncomment) [homes]
	- read only = no
	- create mask = 0775
	- directory mask = 0775
$ sudo smbpasswd myusername
$ /etc/init.d/smbd restart //restart samba service to apply changes
	- should be able to connect to your smb share via windows or mac (http://support.apple.com/kb/HT1568)
$ apt-get install git-core
</pre>
]]></content:encoded>
			<wfw:commentRss>http://codingsnippets.com/create-your-own-linuxmysqlphp-development-box-for-windows-or-mac-os-x/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Resume a file using rsync over ssh</title>
		<link>http://codingsnippets.com/resume-a-file-using-rsync-over-ssh/</link>
		<comments>http://codingsnippets.com/resume-a-file-using-rsync-over-ssh/#comments</comments>
		<pubDate>Sat, 11 Dec 2010 22:18:18 +0000</pubDate>
		<dc:creator>jjaramillo</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://codingsnippets.com/?p=78</guid>
		<description><![CDATA[Sometimes it happens that a file transfer using SCP fails for some reason. Oh no! now you have to start from scratch&#8230; There&#8217;s a quick workaround, use rsync over ssh. No rsyncd is needed, and the transfer is secure. It works like this: rsync -P &#8211;rsh=&#8217;ssh -pPORT_HERE&#8217; USERNAME_HERE@REMOTE_HOST_HERE:REMOTE_FILE_LOCATION_HERE LOCAL_FILE_LOCATION_HERE It may still take some time [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes it happens that a file transfer using SCP fails for some reason. Oh no! now you have to start from scratch&#8230;</p>
<p>There&#8217;s a quick workaround, use rsync over ssh. No rsyncd is needed, and the transfer is secure. It works like this:</p>
<blockquote><p>rsync -P &#8211;rsh=&#8217;ssh -pPORT_HERE&#8217; USERNAME_HERE@REMOTE_HOST_HERE:REMOTE_FILE_LOCATION_HERE LOCAL_FILE_LOCATION_HERE</p></blockquote>
<p>It may still take some time to run based on the file size, but it will certainly take less overall time as it will not transfer the whole file again.</p>
]]></content:encoded>
			<wfw:commentRss>http://codingsnippets.com/resume-a-file-using-rsync-over-ssh/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

