Snipplr - tylerhallhttp://snipplr.com/users/tylerhall
Recent snippets posted on Snipplr.comen-usTue, 20 Mar 2018 01:54:55 GMT(Bash) Send Email Attachment from the Command Linehttp://snipplr.com/view/5919/send-email-attachment-from-the-command-line/
]]>Sat, 19 Apr 2008 16:10:45 GMThttp://snipplr.com/view/5919/send-email-attachment-from-the-command-line/(Bash) SVN Add Recursivelyhttp://snipplr.com/view/5745/svn-add-recursively/
This adds all new files to SVN recursively. It doesn't work for files that have spaces in their name, but why would you create a file with a space in its name in the first place? ]]>Tue, 08 Apr 2008 02:54:09 GMThttp://snipplr.com/view/5745/svn-add-recursively/(PHP) Build Nested Array From SQLhttp://snipplr.com/view/4383/build-nested-array-from-sql/
During the time that Iâ€™ve been programming Iâ€™ve continually run into times when I needed to be able to store a multi-level list into a database and retrieve it. Iâ€™ve used this in a CMS system to allow uses to create and nest their own menu options or to allow users to create and nest categories of items. Saving it was never a problem, but retrieving it and building a PHP array with nested structure was a messy task. The problem was that you couldnâ€™t easily enter a variable four levels deep into an array without knowing all of the parents of that item. This was okay if you retrieved the data in order of parents, but that meant if you wanted to sort the data by another column (such as name), you would have to do multiple passes through your data to continually reshuffle it. ]]>Wed, 19 Dec 2007 15:15:51 GMThttp://snipplr.com/view/4383/build-nested-array-from-sql/(Bash) Create SVN Resposhttp://snipplr.com/view/4217/create-svn-respos/
]]>Thu, 29 Nov 2007 13:56:57 GMThttp://snipplr.com/view/4217/create-svn-respos/(Other) Force SSL HTTPS Connectionshttp://snipplr.com/view/3823/force-ssl-https-connections/
Adding these rules to your .htaccess file will force visitors to use https ]]>Wed, 03 Oct 2007 09:44:45 GMThttp://snipplr.com/view/3823/force-ssl-https-connections/(PHP) Undo Register Globalshttp://snipplr.com/view/3758/undo-register-globals/
Some shared hosting providers won't allow you to turn off register globals. This code undoes the effects of having the option turned on. You must run this code *before* *any* other code in your script. ]]>Fri, 21 Sep 2007 12:48:18 GMThttp://snipplr.com/view/3758/undo-register-globals/(Bash) Deny Access to .svn Files From Webhttp://snipplr.com/view/3706/deny-access-to-svn-files-from-web/
If your website is under version control, users may be able to access your .svn files. This mod_rewrite rule serves a 404 error page if they try to access them. Place the following lines in your website's .htaccess file. ]]>Sat, 15 Sep 2007 09:04:29 GMThttp://snipplr.com/view/3706/deny-access-to-svn-files-from-web/(PHP) Generate a Unambiguous Random Passwordhttp://snipplr.com/view/3584/generate-a-unambiguous-random-password/
This function generates a random password of a specified length in lower or mixed case letters and numbers. Ambiguous characters, such as I, L, 1, 0, and O, are left out so the user can easily read the password. ]]>Tue, 28 Aug 2007 14:19:18 GMThttp://snipplr.com/view/3584/generate-a-unambiguous-random-password/(Objective C) Run an NSAlert Sheet in your Cocoa Apphttp://snipplr.com/view/3517/run-an-nsalert-sheet-in-your-cocoa-app/
This code runs an alert sheet in your Cocoa app. You first create an NSAlert object, its properties, and define the method that should be called when the user dismisses the sheet. Then write the corresponding handler that tests for an "OK" or "Cancel" button press. ]]>Tue, 14 Aug 2007 15:21:41 GMThttp://snipplr.com/view/3517/run-an-nsalert-sheet-in-your-cocoa-app/(Bash) Show Connected iTunes Usershttp://snipplr.com/view/3257/show-connected-itunes-users/
Run this command in a terminal window to list the IP addresses of users connected to your shared iTunes library. ]]>Mon, 09 Jul 2007 15:11:07 GMThttp://snipplr.com/view/3257/show-connected-itunes-users/(Bash) Lookup a Domain's MX Records (Mail Server)http://snipplr.com/view/3115/lookup-a-domains-mx-records-mail-server/
This command displays a domain's MX records. ]]>Mon, 02 Jul 2007 08:20:35 GMThttp://snipplr.com/view/3115/lookup-a-domains-mx-records-mail-server/(Bash) Eject CD From OS X Command Linehttp://snipplr.com/view/3059/eject-cd-from-os-x-command-line/
This command ejects a CD or DVD from the command line. ]]>Wed, 27 Jun 2007 15:31:19 GMThttp://snipplr.com/view/3059/eject-cd-from-os-x-command-line/(Bash) Handbrake CLI Presetshttp://snipplr.com/view/3056/handbrake-cli-presets/
Command to convert DVD's to AppleTV, iPod, PS3, and PSP formats using the command line version of HandBrake. ]]>Wed, 27 Jun 2007 11:43:32 GMThttp://snipplr.com/view/3056/handbrake-cli-presets/(Bash) Modify Exif Date Datahttp://snipplr.com/view/2859/modify-exif-date-data/
]]>Wed, 13 Jun 2007 18:07:16 GMThttp://snipplr.com/view/2859/modify-exif-date-data/(PHP) Convert String to Slughttp://snipplr.com/view/2809/convert-string-to-slug/
This filters a string into a "friendly" string for use in URL's. It converts the string to lower case and replaces any non-alphanumeric (and accented) characters with dashes. ]]>Wed, 06 Jun 2007 11:38:06 GMThttp://snipplr.com/view/2809/convert-string-to-slug/(PHP) Get Full URLhttp://snipplr.com/view/2734/get-full-url/
Returns the full URL of the current page - including any query parameters. ]]>Fri, 25 May 2007 20:45:25 GMThttp://snipplr.com/view/2734/get-full-url/(Other) Force Website To Not Use WWW Prefixhttp://snipplr.com/view/2613/force-website-to-not-use-www-prefix/
This mod_rewrite rule will force visitors who go to www.domain.com to be redirected to domain.com ]]>Tue, 08 May 2007 15:07:47 GMThttp://snipplr.com/view/2613/force-website-to-not-use-www-prefix/(Bash) Enable Safari Debug Menuhttp://snipplr.com/view/2610/enable-safari-debug-menu/
Run this command in a terminal window to turn on Safari's debug menu. ]]>Mon, 07 May 2007 13:23:12 GMThttp://snipplr.com/view/2610/enable-safari-debug-menu/(Bash) Unmount All AFP Network Shareshttp://snipplr.com/view/2601/unmount-all-afp-network-shares/
This command will force all mounted AFP network drive to disconnect. I've set this to run automatically each time my laptop sleeps so that if I wake it up on a different network Finder won't freak out. ]]>Fri, 04 May 2007 15:01:18 GMThttp://snipplr.com/view/2601/unmount-all-afp-network-shares/(PHP) Calculate the Distance Between Two Coordinates (latitude, longitude)http://snipplr.com/view/2531/calculate-the-distance-between-two-coordinates-latitude-longitude/
This PHP function calculates the distance between to pairs of latitude longitude coordinates. Returns the distance in miles or kilometers. ]]>Tue, 24 Apr 2007 11:46:36 GMThttp://snipplr.com/view/2531/calculate-the-distance-between-two-coordinates-latitude-longitude/