<?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>Jonas Stendahl Portfolio</title>
	<atom:link href="http://www.jyggen.com/feed" rel="self" type="application/rss+xml" />
	<link>http://www.jyggen.com</link>
	<description>Web Application Developer</description>
	<lastBuildDate>Mon, 02 Aug 2010 02:54:21 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Minify &#8211; compress your files on the fly!</title>
		<link>http://www.jyggen.com/blog/minify-compress-your-files-on-the-fly</link>
		<comments>http://www.jyggen.com/blog/minify-compress-your-files-on-the-fly#comments</comments>
		<pubDate>Fri, 26 Mar 2010 12:18:35 +0000</pubDate>
		<dc:creator>Jonas Stendahl</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[cache]]></category>
		<category><![CDATA[compress]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Minify]]></category>
		<category><![CDATA[on the fly]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.jyggen.com/?p=116</guid>
		<description><![CDATA[Are you, like me, one of those who keeps JavaScript and CSS in multiple files for better structure and who don’t compress the code because you want to have the readability intact in your development environment? Well, then this script is for you! I give you Minify, a script which combines and compress your files [...]]]></description>
			<content:encoded><![CDATA[<p>Are you, like me, one of those who keeps JavaScript and CSS in multiple files for better structure and who don’t compress the code because you want to have the readability intact in your development environment? Well, then this script is for you!</p>
<p>I give you Minify, a script which combines and compress your files on the fly. This way the files get smaller and the client only have to make one request to the server. Just include the class in the top of the page, somewhere before you include your CSS/JavaScript, give it a few parameters and it will do everything for you. Now you can have how many files you want and edit whenever you want as long as you include the CSS/JavaScript file generated by Minify.<span id="more-116"></span></p>
<p>But, won’t it slow down the execution of the page to run Minify every time? No! First of all, you’ll barely notice when the script actually runs because it doesn’t take any time at all. And second, it won’t run the script if there is no change to the source files. The script is smart enough to store the hash of every file in a cache file and will just check against it.</p>
<p>I made the function which Minify is based on a few months ago when I tried to figure out a way to compress my files automatically and I’ve used it for two or three projects. I realized that there should be an easier way to integrate the script into an existing code and that’s why I made Minify. The original script used PHP’s function filemtime() to check if a file had been modified since the minified version was generated. It work decently, but if you copy/paste an old file from another project it will still have the same modified time and therefore will the minified version be newer. This and a lot of other stuff were fixed when I changed to the existing system, which is faster too!</p>
<p>So, what’s next for Minify? Well, first of all I want to fix all the issues listed below and more optimization. A nice thing would be native JavaScript and CSS compression in Minify.class.php to keep it in one file. Can you think of something else to add? Suggest it!</p>
<p>Please comment below what you think about the script. Don&#8217;t be afraid to report issues, improvements, feedback etc. below and remeber to tell your friends! <img src='http://www.jyggen.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><a href="http://www.jyggen.com/download/Minify">Download <strong>Minify r9</strong> now!</a></p>
<p><strong>Information</strong></p>
<p>The JSMin Class is based on code by <a href="http://code.google.com/p/jsmin-php/" target="_blank" onclick="pageTracker._trackPageview('/outgoing/code.google.com/p/jsmin-php/?referer=');">Ryan Grove</a> and CSSMin Class is based on code by <a href="http://www.codenothing.com" target="_blank" onclick="pageTracker._trackPageview('/outgoing/www.codenothing.com?referer=');">Corey Hart</a>. Current version of Minify (r9) was released  August 2nd, 2010.</p>
<p><strong>Arguments</strong></p>
<pre class="brush:php">type     = type: enum(css,js) - required: yes - default: n/a
dir      = type: string       - required: yes - default: n/a
file     = type: string       - required: yes - default: n/a
filter   = type: array        - required: no  - default: array()
priority = type: array        - required: no  - default: array()
debug    = type: boolean      - required: no  - default: false</pre>
<p><strong>Example Usage</strong></p>
<pre class="brush:php">require 'Minify.class.php';
new Minify('css',
           'css/',
           'styles.min.css',
           array('fixIE.css', 'debug.css'),
           array('reset.css'),
           true);</pre>
<p><strong>Known Issues</strong></p>
<ul>
<li> Minify will crash if it lacks the right permissions and/or the directory is not writable (fixed?).</li>
</ul>
<p>These issues will most likely be fixed in upcoming releases of Minify. Stay tuned!</p>
<p><strong>Change Log</strong></p>
<ul>
<li>r9:
<ul>
<li>Updated CSSMin to latest trunk (7c4b536f1449eb7be3ca).</li>
<li>Added the current version of Minify to the debug output.</li>
<li>Minor code cleanup.</li>
</ul>
</li>
<li>r8:
<ul>
<li>Updated CSSMin to latest trunk (1ebdcc1ed7569ee7751bf17).</li>
</ul>
</li>
<li>r7:
<ul>
<li>Changed caching method again, this time to the SFV format (CRC32).</li>
<li>Remade the debug output. If the script doesn&#8217;t work it&#8217;ll be easier to find the cause.</li>
</ul>
</li>
<li>r6:
<ul>
<li>Fixed an issue where the script would include every file twice and ignore the priority array.</li>
</ul>
</li>
<li>r5:
<ul>
<li>Changed caching method for a faster and smaller cache. If problem occurs with this new release try to delete your old cache files.</li>
<li>Fixed a notice in CSSMin Class triggered by empty attributes in your stylesheet.</li>
</ul>
</li>
<li>r4:
<ul>
<li>Lots of code optimization.</li>
<li>Fixed the issue with files being compressed in alphabetical order and break thing. The new argument priority minifies the files in it before the rest. Perfect way to compress the jquery library before your jquery calls!</li>
<li>Fixed a bug where the cache would become empty and crash the script everytime.</li>
</ul>
</li>
<li>r3:
<ul>
<li>Public release!</li>
<li>The minified file (specified in the file argument) will now automatically be included in the filter argument to stop an evil loop which will minify the files every page load instead of using the cache.</li>
<li>The name of the class is now Minify instead of minify.</li>
<li>Made a few changes to the example usage.</li>
<li>Renamed the cache files from .md4 to .cache for better understanding of their functionality.</li>
<li>The cache is now checked against a hash in raw binary data instead of a hash in lowercase hexits for faster execution (like ~200 microseconds!).</li>
<li>Added a &#8220;Known Issues&#8221; section with all issues and their possible workarounds.</li>
<li>Spelling and grammar fixed is various locations.</li>
<li>Moved JSMin.class.php and CSSMin.class.php to the folder minify for better structure, will hopefully be integrated in the main file in a future release.</li>
<li>Cleaned up some whitespaces &#8211; everything for a smaller file! <img src='http://www.jyggen.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </li>
</ul>
</li>
<li>r2:
<ul>
<li>Deleted the folder &#8220;var&#8221;. The files are now included in the CSSMin class.</li>
<li>More comments in the code.</li>
<li>Added a bunch of options for the css compressor in CSSMin.class.php.</li>
<li>The CSSMin class shouldn&#8217;t fill the page with notices (temp fix!).</li>
<li>Example usage code.</li>
</ul>
</li>
<li>r1:
<ul>
<li>First test code produced.</li>
</ul>
</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.jyggen.com/blog/minify-compress-your-files-on-the-fly/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Store your passwords in a secure way!</title>
		<link>http://www.jyggen.com/blog/store-your-passwords-in-a-secure-way</link>
		<comments>http://www.jyggen.com/blog/store-your-passwords-in-a-secure-way#comments</comments>
		<pubDate>Thu, 11 Mar 2010 18:38:38 +0000</pubDate>
		<dc:creator>Jonas Stendahl</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[algorithm]]></category>
		<category><![CDATA[password]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[salt]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://www.jyggen.com/?p=77</guid>
		<description><![CDATA[Update (2010-05-29):The code below is outdated, latest version can be found here. I was writing a basic register-/login-script yesterday and when I did the part where it hashes the password with a salt I realized that there should be a more secure way to store passwords, so I wrote this function. function salt($password, $username, $salt [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Update (2010-05-29):</strong>The code below is outdated, latest version can be found <a href="http://www.jyggen.com/download/salt.func.php">here</a>.</p>
<p>I was writing a basic register-/login-script yesterday and when I did the part where it hashes the password with a salt I realized that there should be a more secure way to store passwords, so I wrote this function.</p>
<pre class="brush:php">
function salt($password, $username, $salt = 'b_Il-w63') {   

    /* Split the username and the password into two parts with "(string/2)+1" chars in each */
    $user = str_split($username, (strlen($username)/2)+1);
    $pass = str_split($password, (strlen($password)/2)+1);

    /* get the first character in the username and the password and convert them to its ascii value */
    $user_ord = ord($username[0]);
    $pass_ord = ord($password[0]);

    /* merge all variables into a special pattern */
    $string = sprintf('46%s-3S%s-%u-%s-%u-1a%s-F4%s', $user[0], $pass[0], $user_ord, $salt, $pass_ord, $user[1], $pass[1]);

    /* hash the string with sha512, and then it again with md5 */
    $hash = hash('sha512', $string);
    $return = hash('md5', $hash);

    /* reverse the md5 hash and return it */
    return strrev($return);

}
</pre>
<p>This way, even if someone can produce a rainbow table for the algorithm, and has the salt to do it with, they will never know where in the hash parameter the salts was placed, because they don&#8217;t know the length and first letter of the actual password. And of course we&#8217;ll salt it with a string (third parameter) which is hidden deep in a configuration file somewhere, which requires the <em>skiddie</em> to actually access your files to get it.</p>
<p>When the string is ready we hash it with <em>sha512</em> and then again with <em>md5</em> (less byte to store in the database) and after that the function returns the hash. One thing&#8217;s for sure, I&#8217;ll use this for all my projects <img src='http://www.jyggen.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jyggen.com/blog/store-your-passwords-in-a-secure-way/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Tour 4 Dead</title>
		<link>http://www.jyggen.com/web/tour-4-dead</link>
		<comments>http://www.jyggen.com/web/tour-4-dead#comments</comments>
		<pubDate>Tue, 09 Feb 2010 12:47:08 +0000</pubDate>
		<dc:creator>Jonas Stendahl</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[Ajax]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[MySQLi]]></category>
		<category><![CDATA[OOP]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tour 4 Dead]]></category>
		<category><![CDATA[work-in-progress]]></category>
		<category><![CDATA[XHTML]]></category>

		<guid isPermaLink="false">http://www.jyggen.com/?p=68</guid>
		<description><![CDATA[Tour 4 Dead is a tournament site/system for Valve Software&#8217;s two games Left 4 Dead and Left 4 Dead 2. As a logged in user you can create tournaments, create teams with other users and participate in tournaments with that team. There is also a few community features on the site such as forums, profiles [...]]]></description>
			<content:encoded><![CDATA[<p>Tour 4 Dead is a tournament site/system for Valve Software&#8217;s two games Left 4 Dead and Left 4 Dead 2. As a logged in user you can create tournaments, create teams with other users and participate in tournaments with that team. There is also a few community features on the site such as forums, profiles etc.</p>
<p>This site is not finished yet, but will be in the upcoming weeks. The plan is to test the system a few months and then, if the site gets popular, expand to more games such as Modern Warfare 2 and Counter-Strike. Design is once again done by <a href="mailto:fredrik.larsson@zazu.se">Fredrik Larsson</a>.</p>
<ul>
<li><strong>URL:</strong><a href="http://t4d.jyggen.com/" onclick="pageTracker._trackPageview('/outgoing/t4d.jyggen.com/?referer=');"> t4d.jyggen.com</a></li>
<li><strong>Published: </strong>not yet</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.jyggen.com/web/tour-4-dead/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Musiclist</title>
		<link>http://www.jyggen.com/web/musiclist</link>
		<comments>http://www.jyggen.com/web/musiclist#comments</comments>
		<pubDate>Tue, 09 Feb 2010 12:38:58 +0000</pubDate>
		<dc:creator>Jonas Stendahl</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[jobs]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[music]]></category>
		<category><![CDATA[musiclist]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[XHTML]]></category>

		<guid isPermaLink="false">http://www.jyggen.com/?p=64</guid>
		<description><![CDATA[A site made for Young Entertainment Stockholm. Design by Fredrik Larsson. &#8220;Musiclist ägs och drivs av Young Entertainment Stockholm Handelsbolag. Företaget har sitt säte och kontor i Stockholm. Webbplatsen lanserades i januari 2009 för allmänheten, i syfte att uppmärksamma artister och deras musik. Musiclist.se tillhandahåller ingen form eller typ av musik, utan använder sig utav utomstående databaser [...]]]></description>
			<content:encoded><![CDATA[<p>A site made for Young Entertainment Stockholm. Design by <a href="mailto:fredrik.larsson@zazu.se">Fredrik Larsson</a>.</p>
<p>&#8220;<em>Musiclist ägs och drivs av Young Entertainment Stockholm Handelsbolag. Företaget har sitt säte och kontor i Stockholm. Webbplatsen lanserades i januari 2009 för allmänheten, i syfte att uppmärksamma artister och deras musik. Musiclist.se tillhandahåller ingen form eller typ av musik, utan använder sig utav utomstående databaser och webbplatser på internet. Young Entertainment Stockholm innehar även rättigheterna till www.musiclist.nu samt www.musiclist.dk</em>&#8221;</p>
<ul>
<li><strong>URL:</strong> <a href="http://www.musiclist.se" onclick="pageTracker._trackPageview('/outgoing/www.musiclist.se?referer=');">musiclist.se</a></li>
<li><strong>Published: </strong>January 21, 2009</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.jyggen.com/web/musiclist/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Playback Spelförening v2.0</title>
		<link>http://www.jyggen.com/web/playback-spelforening-v-2</link>
		<comments>http://www.jyggen.com/web/playback-spelforening-v-2#comments</comments>
		<pubDate>Sun, 10 Jan 2010 16:28:13 +0000</pubDate>
		<dc:creator>Jonas Stendahl</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[chairman]]></category>
		<category><![CDATA[community]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[non-profit association]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">https://www.jyggen.com/?p=41</guid>
		<description><![CDATA[Playback is a non-profit association that I was the chairman of for almost three years. The main purpose for this association is to host LAN Parties and other gaming related things. Since most of the members are old friends from the ninth grade, it&#8217;s also a nice way to stay in touch with each other [...]]]></description>
			<content:encoded><![CDATA[<p>Playback is a non-profit association that I was the chairman of for almost three years. The main purpose for this association is to host LAN Parties and other gaming related things. Since most of the members are old friends from the ninth grade, it&#8217;s also a nice way to stay in touch with each other after the &#8220;split up&#8221;.</p>
<p>This is one of my first <em>released</em> php sites so I feel some kind of proudness over it, even though it&#8217;s kind of messy and un-optimized. Design, xhtml and CSS made by <a href="mailto:fredrik.larsson@zazu.se" target="_blank">Fredrik Larsson,</a> who is the <span style="text-decoration: line-through;">secretary</span> chairman in the association.</p>
<ul>
<li><strong>URL:</strong> <a href="http://playback.sverok.net" target="_blank" onclick="pageTracker._trackPageview('/outgoing/playback.sverok.net?referer=');">playback.sverok.net</a></li>
<li><strong>Published: </strong>June 6, 2008<strong> </strong><strong></strong><strong></strong><span style="color: #252525;"><strong><br />
</strong></span></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.jyggen.com/web/playback-spelforening-v-2/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>serieous.se</title>
		<link>http://www.jyggen.com/web/serieous-se</link>
		<comments>http://www.jyggen.com/web/serieous-se#comments</comments>
		<pubDate>Sun, 10 Jan 2010 15:59:14 +0000</pubDate>
		<dc:creator>Jonas Stendahl</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[community]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[MySQLi]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[work-in-progress]]></category>
		<category><![CDATA[XHTML]]></category>

		<guid isPermaLink="false">http://www.jyggen.com/?p=27</guid>
		<description><![CDATA[serieous.se was a school project created in early 2009 by me and Fredrik Larsson; he made the design and I coded it. The site is almost complete but is put on hold for the moment because we&#8217;re both busy with other stuff. serieous.se is mainly a Swedish news site which post news and rumors about [...]]]></description>
			<content:encoded><![CDATA[<p>serieous.se was a school project created in early 2009 by me and <a href="mailto:fredrik.larsson@zazu.se" target="_blank">Fredrik Larsson</a>; he made the design and I coded it. The site is almost complete but is put on hold for the moment because we&#8217;re both busy with other stuff.</p>
<p>serieous.se is mainly a Swedish news site which post news and rumors about (mostly) American TV-shows e.g. Lost, Heroes, Family Guy. Around this news site we&#8217;ve build up a community with profiles, guest books, forums etc. There&#8217;s also an archive with downloadable files, an information page about every show and much more!</p>
<ul>
<li><strong>URL:</strong> <a href="http://www.serieous.se" target="_blank" onclick="pageTracker._trackPageview('/outgoing/www.serieous.se?referer=');">www.serieous.se</a></li>
<li><strong>Published:</strong> March 2, 2009</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.jyggen.com/web/serieous-se/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk
Page Caching using disk (enhanced) (user agent is rejected)

Served from: www.jyggen.com @ 2010-09-06 13:37:32 -->