<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
	<channel>
	<title>Leon Radley</title>
	<link>http://leon.radley.se</link>
	<language>en</language>
	<webMaster>Leon Radley</webMaster>
	<pubDate>2012-02-08T04:39:35-08:00</pubDate>
	<copyright>Copyright 2010-2012</copyright>
	<ttl>60</ttl>
	<description>Blog of Leon Radley, professional web developer</description>
	
		<item>
			<title>Sublime Text 2 - YUI Compressor Plugin</title>
			<link>http://leon.radley.se/2012/02/st2-yui-compressor/</link>
			<pubDate>2012-02-01T00:00:00-08:00</pubDate>
			<guid>http://leon.radley.se/2012/02/st2-yui-compressor/</guid>
			<description>&lt;h4&gt;Could't find a plugin for using the YUI Compressor so I wrote one.&lt;/h4&gt;

&lt;p&gt;The plugin calls the yui-compressor jar file, I've used some settings to avoid putting everything on one single line since most text editors grind to a halt
when having to deal with long lines.&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;bash&quot;&gt;java
-jar yuicompressor-2.4.7.jar
--charset utf-8
--preserve-semi
--line-break 150
-o &lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;file_base_name&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;-min.&lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;file_extension&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;h2&gt;Installation&lt;/h2&gt;

&lt;p&gt;Use package control &lt;a href=&quot;http://wbond.net/sublime_packages/package_control&quot;&gt;http://wbond.net/sublime_packages/package_control&lt;/a&gt; and search for YUI Compressor&lt;/p&gt;

&lt;p&gt;The source code can be found here: &lt;a href=&quot;https://github.com/leon/YUI-Compressor&quot;&gt;https://github.com/leon/YUI-Compressor&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;Gettings started&lt;/h2&gt;

&lt;p&gt;Make sure you have java installed, then open a .js or .css file and press &lt;code&gt;F7&lt;/code&gt; or &lt;code&gt;command + b&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The plugin generates a new file along side the original with the extension &lt;code&gt;.min.js&lt;/code&gt; or &lt;code&gt;.min.css&lt;/code&gt;&lt;/p&gt;
</description>
			
				<category domain="http://leon.radley.se/tag/sublime-text-2/">sublime-text-2</category>
			
		</item>
	
		<item>
			<title>SSH Tips</title>
			<link>http://leon.radley.se/2012/01/ssh-tips/</link>
			<pubDate>2012-01-19T00:00:00-08:00</pubDate>
			<guid>http://leon.radley.se/2012/01/ssh-tips/</guid>
			<description>&lt;h4&gt;I manage a lot of servers, login in quickly without having to look up passwords or remember which username it was should be simple, I'll show you how simple it can get!.&lt;/h4&gt;

&lt;p&gt;Below I will give you some tips of how to improve your SSH workflow.&lt;/p&gt;

&lt;h2&gt;ssh-copy-id is great!&lt;/h2&gt;

&lt;p&gt;By using &lt;code&gt;ssh-copy-id&lt;/code&gt; you connect to the server using &lt;strong&gt;secure keys&lt;/strong&gt; instead of having to use a password.&lt;/p&gt;

&lt;p&gt;The syntax of ssh-copy-id is the following:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;ssh-copy-id user@server.com
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;and then it will ask for the password.&lt;/p&gt;

&lt;p&gt;it works by copying your public key from &lt;code&gt;~/.ssh/id_rsa.pub&lt;/code&gt; to the servers &lt;code&gt;~/.ssh/authorized_keys&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;And when you then type &lt;code&gt;ssh root@server.com&lt;/code&gt; it will first try to connect via secure keys which compares your private key &lt;code&gt;~/.ssh/id_rsa&lt;/code&gt; with the public key you copied with &lt;code&gt;ssh-copy-id&lt;/code&gt; before falling back to using passwords.&lt;/p&gt;

&lt;h4&gt;Generate new key&lt;/h4&gt;

&lt;p&gt;You can generate your private and public key with the following command:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;ssh-keygen -t rsa -b 2048
&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;Simplify further&lt;/h2&gt;

&lt;p&gt;Now it's time to simplify the ssh command. We still need to specify the user and the host when we connect but by specifying this in the ssh config file we can do away with a lot of typing.&lt;/p&gt;

&lt;p&gt;Open the file &lt;code&gt;~/.ssh/config&lt;/code&gt; and put the following in it:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;bash&quot;&gt;&lt;span class=&quot;c&quot;&gt;# Stop timing out connections&lt;/span&gt;
ServerAliveInterval 300
ServerAliveCountMax 20

&lt;span class=&quot;c&quot;&gt;# Specify default user&lt;/span&gt;
User root

Host myalias
    HostName server.com
    User root

Host myalias2
    HostName server2.com
    User root2
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;The first is to stop OSX Lion from closing down the connection. (If you don´t specify this, you get &lt;code&gt;Broken pipe&lt;/code&gt; syndrome)&lt;/p&gt;

&lt;p&gt;I hope this will help you become a better unix hacker :)&lt;/p&gt;
</description>
			
				<category domain="http://leon.radley.se/tag/tip/">tip</category>
			
				<category domain="http://leon.radley.se/tag/unix/">unix</category>
			
		</item>
	
		<item>
			<title>MooTools Carousel</title>
			<link>http://leon.radley.se/2011/12/mootools-carousel/</link>
			<pubDate>2011-12-13T00:00:00-08:00</pubDate>
			<guid>http://leon.radley.se/2011/12/mootools-carousel/</guid>
			<description>&lt;h4&gt;I wrote a 3D carousel in 2006. Back then it was written in the newly released ActionScript 3. But as you all know, flash isn't what all the cool guys use nowadays.&lt;/h4&gt;

&lt;p&gt;So what I've done is revamp my old code and made it a lot cooler. By using &lt;a href=&quot;https://github.com/clau/Fx.Spring/&quot; title=&quot;MooTools Fx.Spring&quot;&gt;Fx.Spring&lt;/a&gt; I could simulate friction.&lt;/p&gt;

&lt;p&gt;Try swiping the image. Also try it on the iPad it's touch enabled!&lt;/p&gt;

&lt;p&gt;&lt;nav class=&quot;actions&quot;&gt;
&lt;a class=&quot;button&quot; href=&quot;/labs/carousel/&quot;&gt;Demo&lt;/a&gt;
&lt;/nav&gt;&lt;/p&gt;

&lt;h2&gt;The tech&lt;/h2&gt;

&lt;p&gt;By using the new javascript function &lt;code&gt;RequestAnimationFrame&lt;/code&gt; I could make it run alot smoother. Otherwise the javascript uses &lt;code&gt;setTimeout(fn, 60)&lt;/code&gt; which causes the browser to stall if it can't handle the load.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;RequestAnimationFrame&lt;/code&gt; handles it differently, it fires your callback whenever your system can handle it.&lt;/p&gt;

&lt;p&gt;You also get a &lt;strong&gt;bonus&lt;/strong&gt;, when the browser detects that your tab isn't visible it doesn't fire any &lt;code&gt;RequestAnimationFrame&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;Options&lt;/h3&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;js&quot;&gt;&lt;span class=&quot;nx&quot;&gt;options&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;fps&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;frames&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;autoPlay&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;resume&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;mouse&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;inverseMouse&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;move&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;stiffness&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;friction&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;threshold&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;0.05&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;h3&gt;Usage&lt;/h3&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;js&quot;&gt;&lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Carousel&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;placeholderimageid&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;img/image-sequence{num}.jpg&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;frames&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;36&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;autoPlay&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;



</description>
			
				<category domain="http://leon.radley.se/tag/mootools/">mootools</category>
			
		</item>
	
	</channel>
</rss>
