<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>Snipplr</title>
    <description>Recent snippets posted on Snipplr.com</description>
    <link>https://snipplr.com/</link>
    <lastBuildDate>Tue, 09 Jun 2026 15:11:36 +0000</lastBuildDate>
    <item>
      <title>(PHP) Secure Static Session Class (Handles Arrays) - halk</title>
      <link>https://snipplr.com/view/68697/secure-static-session-class-handles-arrays</link>
      <description>&lt;p&gt;This is a static session wrapper that handles single variables and arrays.  It allows setting, resetting, and deleting session variables (without destroying the session).  It regenerates the session id every time a session is started to prevent session hijacking.  See Examples of use below the code or (https://gist.github.com/4128373)&lt;/p&gt;</description>
      <pubDate>Thu, 22 Nov 2012 11:14:53 UTC</pubDate>
      <guid>https://snipplr.com/view/68697/secure-static-session-class-handles-arrays</guid>
    </item>
    <item>
      <title>(PHP) HTML Helper Function Create Any Element With Any Number Of Attributes (self-closing and container tags) - halk</title>
      <link>https://snipplr.com/view/68682/html-helper-function-create-any-element-with-any-number-of-attributes-selfclosing-and-container-tags</link>
      <description>&lt;p&gt;/**&#13;
 * THIS FUNCTION WILL RENDER A CONTAINER OR SELF-CLOSING HTML ELEMENT.&#13;
 * IT AUTO DETECTS WHAT TYPE YOU WANT&#13;
 * BASED ON RATHER OR NOT YOU SET A _data KEY IN THE ARRAY OF&#13;
 * ATTRIBUTES PASSED TO THE FUNCTION&#13;
 * &#13;
 * USING AN ASSOCIATIVE ARRAY ATTRIBUTES ARE ASSIGNED TO THE ELEMENT&#13;
* &#13;
 * IF THE KEY _data IS SET IN THE $propBag ARRAY&#13;
 * _data WILL BE INSERTED BETWEEN THE START AND END TAGS&#13;
 * AS THE ELEMENT IS NOT SELF CLOSING BECAUSE IT HAS DATA TO CONTAIN.&#13;
 * &#13;
 * IF _data IS NOT SENT IN THE ARRAY THE TAG WILL BE FORMED AS SELF CLOSING&#13;
 * BECAUSE IT HAS NO DATA TO CONTAIN&#13;
 */&#13;
SEE Examples Of Use Below The Code&lt;/p&gt;</description>
      <pubDate>Wed, 21 Nov 2012 08:19:17 UTC</pubDate>
      <guid>https://snipplr.com/view/68682/html-helper-function-create-any-element-with-any-number-of-attributes-selfclosing-and-container-tags</guid>
    </item>
    <item>
      <title>(PHP) Regex Clipboard Class (Mini-Template Engine) - halk</title>
      <link>https://snipplr.com/view/68633/regex-clipboard-class-minitemplate-engine</link>
      <description>&lt;p&gt;https://gist.github.com/4098493&#13;
(examples of use below the class code)&#13;
This class allows you to load a file of snippets that are really mini-templates copy them from your repository fill the token slots in them the with your data and render them as part of the view.  See example below the code for the format of the snippet file.&lt;/p&gt;</description>
      <pubDate>Sun, 18 Nov 2012 08:23:12 UTC</pubDate>
      <guid>https://snipplr.com/view/68633/regex-clipboard-class-minitemplate-engine</guid>
    </item>
    <item>
      <title>(PHP) Automatically turn all text urls into working Hyperlinks - halk</title>
      <link>https://snipplr.com/view/68586/automatically-turn-all-text-urls-into-working-hyperlinks</link>
      <description>&lt;p&gt;Does not require http in the text to link.  It must start with www however.  Optionaly make the links popup in a new window.&lt;/p&gt;</description>
      <pubDate>Fri, 16 Nov 2012 19:58:41 UTC</pubDate>
      <guid>https://snipplr.com/view/68586/automatically-turn-all-text-urls-into-working-hyperlinks</guid>
    </item>
    <item>
      <title>(PHP) JSONP Public API with jQuery getJSON (callback) (MySql) - halk</title>
      <link>https://snipplr.com/view/68583/jsonp-public-api-with-jquery-getjson-callback-mysql</link>
      <description>&lt;p&gt;This is a public jsonp api. I use it with jQuery Like This:&#13;
$.getJSON("http://yourdomain/yourpath/jsonp_api.php?method=getSchema&amp;params=your_db_name&amp;jsoncallback=?",&#13;
        function(data){&#13;
         //DO SOMETHING WITH THE DATA HERE&#13;
        }&#13;
    );&lt;/p&gt;</description>
      <pubDate>Fri, 16 Nov 2012 09:08:46 UTC</pubDate>
      <guid>https://snipplr.com/view/68583/jsonp-public-api-with-jquery-getjson-callback-mysql</guid>
    </item>
    <item>
      <title>(PHP) POST Function Using HTTP Headers Return Result In A Variable - halk</title>
      <link>https://snipplr.com/view/68151/post-function-using-http-headers-return-result-in-a-variable</link>
      <description>&lt;p&gt;This function dosen't use curl, or any other libraries.  Just include it in your function library and use it like this:&#13;
$Post_result = _post('http://www.yourdomain.com/your_path/post_api.php',"method=fetchJson&amp;params=select * from user");&lt;/p&gt;</description>
      <pubDate>Wed, 07 Nov 2012 20:40:32 UTC</pubDate>
      <guid>https://snipplr.com/view/68151/post-function-using-http-headers-return-result-in-a-variable</guid>
    </item>
    <item>
      <title>(CSS) LESS MIXIN Simple Quick Gradient - halk</title>
      <link>https://snipplr.com/view/67800/less-mixin-simple-quick-gradient</link>
      <description>&lt;p&gt;Generate Gradients Simply and Quicly&lt;/p&gt;</description>
      <pubDate>Fri, 19 Oct 2012 01:43:51 UTC</pubDate>
      <guid>https://snipplr.com/view/67800/less-mixin-simple-quick-gradient</guid>
    </item>
    <item>
      <title>(JavaScript) JSON Tree(1 function 15 lines)Nested Ul from single or multidimensional json object - halk</title>
      <link>https://snipplr.com/view/67767/json-tree1-function-15-linesnested-ul-from-single-or-multidimensional-json-object</link>
      <description>&lt;p&gt;Any valid json object will be recursively traversed building a nested unordered list of its properties and their values.  This example parses the json entered in the text area into an object that is passed to the json_tree() function.  I use the twitter bootstrap to make collapsible trees.  That is the purpose of thee css and the random string i generate.  I left it in as an example of how you might style the returned list.  This is very much a work in progress so if you have any suggestions please post a comment.  I have posted the entire html for a working example page just create the file and open it in your browser.(make sure your json validates - http://jsonlint.com - only valid json will produce a tree)&lt;/p&gt;</description>
      <pubDate>Wed, 17 Oct 2012 04:48:13 UTC</pubDate>
      <guid>https://snipplr.com/view/67767/json-tree1-function-15-linesnested-ul-from-single-or-multidimensional-json-object</guid>
    </item>
    <item>
      <title>(jQuery) Set Default Value for Select (dropdown) Lists Using value attribute - halk</title>
      <link>https://snipplr.com/view/67752/set-default-value-for-select-dropdown-lists-using-value-attribute</link>
      <description>&lt;p&gt;For some reason setting a default value for select elements does not work. This one line of jquery solves that problem.  Assign a value (value="something") to the select tag that is to be the default value.  With jquery get all select elements with a (value) attribute set.  For some reason I couldnt get the value of (value) with jquery, it would only return the first item in the list and not the value of the attribute(value). Oldschool Javascript managed to return it though.  The result is that when the document becomes ready jquery finds all select boxes and changes their value to the value stored in the attribute(value) of the select tag.  This means that you can set default values for select elements in the same way you set them for other elements - by assigning them a (value)  -  value="whatever"&lt;/p&gt;</description>
      <pubDate>Tue, 16 Oct 2012 01:33:32 UTC</pubDate>
      <guid>https://snipplr.com/view/67752/set-default-value-for-select-dropdown-lists-using-value-attribute</guid>
    </item>
    <item>
      <title>(jQuery) Document Ready with Global Ajax Listener and Status Indicator - halk</title>
      <link>https://snipplr.com/view/67740/document-ready-with-global-ajax-listener-and-status-indicator</link>
      <description>&lt;p&gt;This will monitor the status of all ajax calls on the page.  When ajax starts i show an animated spinner gif and display a message that ajax has been requested.  On completion of a call the status returned is displayed and the spinner is hidden to indicate the process is complete.  This is without an extra line of code in any of the functions that call ajax, and applies globaly to all functions that make ajax calls on the page.&lt;/p&gt;</description>
      <pubDate>Mon, 15 Oct 2012 09:19:52 UTC</pubDate>
      <guid>https://snipplr.com/view/67740/document-ready-with-global-ajax-listener-and-status-indicator</guid>
    </item>
    <item>
      <title>(JavaScript) Javascript Equivalent Of PHP foreach - halk</title>
      <link>https://snipplr.com/view/67738/javascript-equivalent-of-php-foreach</link>
      <description>&lt;p&gt;This is the equivalent of doing php's foreach loop in javascript.&lt;/p&gt;</description>
      <pubDate>Mon, 15 Oct 2012 07:36:20 UTC</pubDate>
      <guid>https://snipplr.com/view/67738/javascript-equivalent-of-php-foreach</guid>
    </item>
    <item>
      <title>(PHP) MySql Safe Escape (single var,array,md-array)vs Injection XSS - halk</title>
      <link>https://snipplr.com/view/67730/mysql-safe-escape-single-vararraymdarrayvs-injection-xss</link>
      <description>&lt;p&gt;This is my function for sanitizing data before I insert it into my database.  It handles single variables, single dimensional arrays, and multi-dimensional arrays(recursive).  It sanitizes numeric data(detects if int or float), checks for html tags in the posted data and makes it safe for storage(I store html and code snippets in my db).  It checks for magic quotes and determines if mysql_real_escape_string function exists and if it doesnt mysql_escape_string is used (for older versions of php).&lt;/p&gt;</description>
      <pubDate>Sun, 14 Oct 2012 03:47:55 UTC</pubDate>
      <guid>https://snipplr.com/view/67730/mysql-safe-escape-single-vararraymdarrayvs-injection-xss</guid>
    </item>
  </channel>
</rss>
