<?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-03-04T12:41:55-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 - rsub</title>
			<link>http://leon.radley.se/2012/03/sublime-text-2-rsub/</link>
			<pubDate>2012-03-03T00:00:00-08:00</pubDate>
			<guid>http://leon.radley.se/2012/03/sublime-text-2-rsub/</guid>
			<description>&lt;h2&gt;First a little introduction, what is rmate?&lt;/h2&gt;

&lt;p&gt;I read the &lt;a href=&quot;http://blog.macromates.com/2011/mate-and-rmate/&quot;&gt;blog post&lt;/a&gt; about TextMate 2 adding remote editing.
By typing &lt;code&gt;rmate myfile&lt;/code&gt; on the server, it connects to TextMate 2 via a SSH tunnel making editing a breeze.&lt;/p&gt;

&lt;p&gt;Sublime Text 2 now also has this functionality via the &lt;a href=&quot;https://github.com/Drarok/rsub&quot;&gt;rsub plugin&lt;/a&gt; (search for &lt;code&gt;rsub&lt;/code&gt; via the excellent &lt;a href=&quot;http://wbond.net/sublime_packages/package_control&quot;&gt;Package Control&lt;/a&gt;)
It uses the exact same remote script as TextMate2.&lt;/p&gt;

&lt;h2&gt;Setup SSH to automatically create the tunnel&lt;/h2&gt;

&lt;p&gt;In a previous article &lt;a href=&quot;/2012/01/ssh-tips/&quot;&gt;SSH Tips&lt;/a&gt; I wrote about how a couple of lines in a config file can make your life a whole lot easier.
The new addition to the &lt;code&gt;~/.ssh/config&lt;/code&gt; file is:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;RemoteForward 52698 localhost:52698&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;As soon as you connect to a server via SSH it will start the remote tunnel.&lt;/p&gt;

&lt;h2&gt;ssh-copy-rmate&lt;/h2&gt;

&lt;p&gt;I wanted it to be simple to install the rmate command to the remote server, so I created ssh-copy-rmate.
What it does is downloads the latest rmate script from github and via SSH copies it to the file &lt;code&gt;/usr/local/bin/rmate&lt;/code&gt; on the server and sets the right permissions.&lt;/p&gt;

&lt;p&gt;Since I´m using Sublime Text 2 I also created a clone of the install script called ssh-copy-rsub which names the file on the server to rsub instead of rmate.&lt;/p&gt;

&lt;h3&gt;Install&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://gist.github.com/1965146&quot;&gt;ssh-copy-rmate&lt;/a&gt; if you are using TextMate 2&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://gist.github.com/1957476&quot;&gt;ssh-copy-rsub&lt;/a&gt; if you are using Sublime Text 2&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;and place them in your path or in &lt;code&gt;/usr/local/bin&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;then run &lt;code&gt;ssh-copy-rsub root@myserver.com&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The default is to use the ruby version of the script which requires that you have ruby installed on the server.&lt;/p&gt;

&lt;p&gt;If you specify &lt;code&gt;-b&lt;/code&gt; (&lt;code&gt;ssh-copy-rsub -b root@myserver.com&lt;/code&gt;) it will fetch another version of rmate which doesn't require ruby.&lt;/p&gt;

&lt;h2&gt;References&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/Drarok/rsub&quot;&gt;Sublime Text 2 rsub plugin&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://blog.macromates.com/2011/mate-and-rmate/&quot;&gt;TextMate 2 rmate feature&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/avian/rmate/&quot;&gt;rmate ruby script&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/aurora/rmate/&quot;&gt;rmate shell script&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
			
				<category domain="http://leon.radley.se/tag/sublime-text-2/">sublime-text-2</category>
			
				<category domain="http://leon.radley.se/tag/textmate-2/">textmate-2</category>
			
				<category domain="http://leon.radley.se/tag/unix/">unix</category>
			
		</item>
	
		<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>
