Skip to content

Commit

Permalink
remove inline css to use browser cache instead
Browse files Browse the repository at this point in the history
  • Loading branch information
serianox committed Dec 24, 2018
1 parent ccb27fe commit b6491d7
Show file tree
Hide file tree
Showing 10 changed files with 55 additions and 67 deletions.
5 changes: 1 addition & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
**.frag.html
**.plain.html
**.max.html
**.css
**.frag.html
17 changes: 4 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,11 @@ html = $(patsubst %.md, %.html, $(md))

styl = $(shell find . -type f -name '*.styl')

all: $(html) ## Build all the files
all: $(html) style.css ## Build all the files

%.html: %.max.html html-minifier.conf
html-minifier $< --config-file html-minifier.conf --output=$@

%.max.html: %.frag.html %.css template.slim
slimrb $(word 3, $^) /dev/stdout $< $(word 2, $^) $(patsubst %.max.html, %.html, $@) >$@

%.css: %.plain.html style.css
purifycss $(word 2, $^) $< --min --out=$@

%.plain.html: %.frag.html /dev/null template.slim
slimrb $(word 3, $^) /dev/stdout $< $(word 2, $^) "" >$@
%.html: %.frag.html template.slim html-minifier.conf
slimrb $(word 2, $^) /dev/stdout $< %.html |\
html-minifier --config-file html-minifier.conf --output=$@

%.frag.html: %.md
pandoc $< -f markdown -t html5 -o $@
Expand All @@ -28,7 +20,6 @@ style.css: $(styl)
stylus -c |\
cleancss -O2 >$@

.PRECIOUS: %.max.html %.plain.html %.frag.html %.css
.DEFAULT_GOAL := all

.PHONY: help
Expand Down
38 changes: 19 additions & 19 deletions android-kotlin-migration.html
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<!doctype html><meta charset=utf-8><title>make android-kotlin-migration.html</title><meta content="Thomas Duboucher" name=author><meta content="Thomas Duboucher, Serianox,blog" name=keywords><meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" name=viewport><h1 id=manually-migrating-an-android-project-to-kotlin>Manually migrating an Android project to Kotlin</h1><p>Kotlin is now officialy <a href=https://developer.android.com/kotlin/index.html>Kotlin and Android</a>, and as such I wanted to give it another try. There are of course tutorials <a href=https://kotlinlang.org/docs/tutorials/kotlin-android.html>out there</a>, but they all aim users of Android Studio. Let's see how we can do without.<p>First things first, let's add Kotlin to our build script. We need to add to the <code>build.gradle</code> of our application three things:<ul><li>the repository where Kotlin is found,<li>the dependency to the build tools for Kotlin,<li>the runtime dependencies for our project.</ul><div class=sourceCode><pre class="sourceCode diff"><code class="sourceCode diff">buildscript {
<span class=va>+ repositories {</span>
<span class=va>+ jcenter()</span>
<span class=va>+ mavenCentral()</span>
<span class=va>+ }</span>
<span class=va>+ dependencies {</span>
<span class=va>+ classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.2"</span>
<span class=va>+ }</span>
<span class=va>+}</span>
<span class=va>+</span>
apply plugin: 'com.android.application'
<span class=va>+apply plugin: 'kotlin-android'</span>
<span class=va>+apply plugin: 'kotlin-android-extensions'</span></code></pre></div><div class=sourceCode><pre class="sourceCode diff"><code class="sourceCode diff"> dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:design:23.1.1'
<span class=va>+</span>
<span class=va>+ compile 'org.jetbrains.kotlin:kotlin-stdlib:1.1.2'</span>
<span class=va>+ testCompile 'org.jetbrains.kotlin:kotlin-stdlib:1.1.2'</span>
}</code></pre></div><p>If we run our <code>gradlew</code> script, we can see that it is installing the Kotlkin toolchain, but that no Kotlin code is built. Of course, because there are none yet.<p>Kotlin developers provide an <a href=https://try.kotlinlang.org/ >online Java-to-Kotlkin transpiler</a>. It is far from perfect, but it is enough for beginers with an existing Java project. In our application source directory, we create the same architecture where we replace <code>src/main/java/&lt;package></code> with <code>src/main/kotlin/&lt;package></code>. We transpile all the <code>.java</code> files to <code>.kt</code> and we run again our <code>gradlew</code> script.<p>Voilà.
<!doctype html><meta charset=utf-8><title>make</title><meta content="Thomas Duboucher" name=author><meta content="Thomas Duboucher, Serianox,blog" name=keywords><meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" name=viewport><link href=style.css rel=stylesheet><h1 id=manually-migrating-an-android-project-to-kotlin>Manually migrating an Android project to Kotlin</h1><p>Kotlin is now officialy <a href=https://developer.android.com/kotlin/index.html>Kotlin and Android</a>, and as such I wanted to give it another try. There are of course tutorials <a href=https://kotlinlang.org/docs/tutorials/kotlin-android.html>out there</a>, but they all aim users of Android Studio. Let’s see how we can do without.<p>First things first, let’s add Kotlin to our build script. We need to add to the <code>build.gradle</code> of our application three things:<ul><li>the repository where Kotlin is found,<li>the dependency to the build tools for Kotlin,<li>the runtime dependencies for our project.</ul><div class=sourceCode id=cb1><pre class="sourceCode diff"><code class="sourceCode diff"><a class=sourceLine data-line-number=1 id=cb1-1>buildscript {</a>
<a class=sourceLine data-line-number=2 id=cb1-2><span class=va>+ repositories {</span></a>
<a class=sourceLine data-line-number=3 id=cb1-3><span class=va>+ jcenter()</span></a>
<a class=sourceLine data-line-number=4 id=cb1-4><span class=va>+ mavenCentral()</span></a>
<a class=sourceLine data-line-number=5 id=cb1-5><span class=va>+ }</span></a>
<a class=sourceLine data-line-number=6 id=cb1-6><span class=va>+ dependencies {</span></a>
<a class=sourceLine data-line-number=7 id=cb1-7><span class=va>+ classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.2"</span></a>
<a class=sourceLine data-line-number=8 id=cb1-8><span class=va>+ }</span></a>
<a class=sourceLine data-line-number=9 id=cb1-9><span class=va>+}</span></a>
<a class=sourceLine data-line-number=10 id=cb1-10><span class=va>+</span></a>
<a class=sourceLine data-line-number=11 id=cb1-11> apply plugin: 'com.android.application'</a>
<a class=sourceLine data-line-number=12 id=cb1-12><span class=va>+apply plugin: 'kotlin-android'</span></a>
<a class=sourceLine data-line-number=13 id=cb1-13><span class=va>+apply plugin: 'kotlin-android-extensions'</span></a></code></pre></div><div class=sourceCode id=cb2><pre class="sourceCode diff"><code class="sourceCode diff"><a class=sourceLine data-line-number=1 id=cb2-1> dependencies {</a>
<a class=sourceLine data-line-number=2 id=cb2-2> compile fileTree(dir: 'libs', include: ['*.jar'])</a>
<a class=sourceLine data-line-number=3 id=cb2-3> compile 'com.android.support:design:23.1.1'</a>
<a class=sourceLine data-line-number=4 id=cb2-4><span class=va>+</span></a>
<a class=sourceLine data-line-number=5 id=cb2-5><span class=va>+ compile 'org.jetbrains.kotlin:kotlin-stdlib:1.1.2'</span></a>
<a class=sourceLine data-line-number=6 id=cb2-6><span class=va>+ testCompile 'org.jetbrains.kotlin:kotlin-stdlib:1.1.2'</span></a>
<a class=sourceLine data-line-number=7 id=cb2-7> }</a></code></pre></div><p>If we run our <code>gradlew</code> script, we can see that it is installing the Kotlkin toolchain, but that no Kotlin code is built. Of course, because there are none yet.<p>Kotlin developers provide an <a href=https://try.kotlinlang.org/ >online Java-to-Kotlkin transpiler</a>. It is far from perfect, but it is enough for beginers with an existing Java project. In our application source directory, we create the same architecture where we replace <code>src/main/java/&lt;package></code> with <code>src/main/kotlin/&lt;package></code>. We transpile all the <code>.java</code> files to <code>.kt</code> and we run again our <code>gradlew</code> script.<p>Voilà.
6 changes: 3 additions & 3 deletions android-sdk-install.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<!doctype html><meta charset=utf-8><title>make android-sdk-install.html</title><meta content="Thomas Duboucher" name=author><meta content="Thomas Duboucher, Serianox,blog" name=keywords><meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" name=viewport><h1 id=android-headless-sdk-installation>Android <em>headless</em> SDK installation</h1><p>I wanted to install <em>Android SDK</em> without installing this ugly IDE. The main goal was to rebuild existing projects, so I didn't need something as heavy. The main difficulty came when I downloaded the actual sdk, and receive the following message from Google.<blockquote><p>Because you've downloaded the command line tools (not Android Studio), there are no install instructions.</blockquote><p>First things first. The SDK can be easily found on the download page of the Android developer website. Hidden at the end of the page in a section named <em><a href=https://developer.android.com/studio/index.html#command-tools>Get just the command line tools</a></em>.<p>We download a <code>.zip</code> file, because it's to complicated to provide a tarball, and unzip it somewhere, preferably <code>~/.android</code>.<p>Then we update your <code>~/.profile</code>, or wherever we put your env to include the following lines <em>mutatis mutandis</em> and reload our session.<div class=sourceCode><pre class="sourceCode bash"><code class="sourceCode bash"><span class=bu>export</span> <span class=va>ANDROID_HOME=</span><span class=st>"</span><span class=va>$HOME</span><span class=st>/.android"</span>
<span class=bu>export</span> <span class=va>PATH=</span><span class=st>"</span><span class=va>$ANDROID_HOME</span><span class=st>/tools:</span><span class=va>$ANDROID_HOME</span><span class=st>/tools/bin:</span><span class=va>$ANDROID_HOME</span><span class=st>/platform-tools:</span><span class=va>$PATH</span><span class=st>"</span></code></pre></div><p>Once we're here, the installation is straightforward once we now which command to run.<div class=sourceCode><pre class="sourceCode bash"><code class="sourceCode bash"><span class=ex>android</span> update sdk</code></pre></div><p>Then we must install some build tools.<div class=sourceCode><pre class="sourceCode bash"><code class="sourceCode bash"><span class=ex>sdkmanager</span> <span class=st>"platforms;android-23"</span>
<span class=ex>sdkmanager</span> <span class=st>"build-tools;23.0.1"</span></code></pre></div><p>And also we must not forget to install all those <code>compat</code> libraries.<div class=sourceCode><pre class="sourceCode bash"><code class="sourceCode bash"><span class=ex>sdkmanager</span> <span class=st>"extras;android;m2repository"</span></code></pre></div><p>And <em>voilà</em>!
<!doctype html><meta charset=utf-8><title>make</title><meta content="Thomas Duboucher" name=author><meta content="Thomas Duboucher, Serianox,blog" name=keywords><meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" name=viewport><link href=style.css rel=stylesheet><h1 id=android-headless-sdk-installation>Android <em>headless</em> SDK installation</h1><p>I wanted to install <em>Android SDK</em> without installing this ugly IDE. The main goal was to rebuild existing projects, so I didn’t need something as heavy. The main difficulty came when I downloaded the actual sdk, and receive the following message from Google.<blockquote><p>Because you’ve downloaded the command line tools (not Android Studio), there are no install instructions.</blockquote><p>First things first. The SDK can be easily found on the download page of the Android developer website. Hidden at the end of the page in a section named <em><a href=https://developer.android.com/studio/index.html#command-tools>Get just the command line tools</a></em>.<p>We download a <code>.zip</code> file, because it’s to complicated to provide a tarball, and unzip it somewhere, preferably <code>~/.android</code>.<p>Then we update your <code>~/.profile</code>, or wherever we put your env to include the following lines <em>mutatis mutandis</em> and reload our session.<div class=sourceCode id=cb1><pre class="sourceCode bash"><code class="sourceCode bash"><a class=sourceLine data-line-number=1 id=cb1-1><span class=bu>export</span> <span class=va>ANDROID_HOME=</span><span class=st>"</span><span class=va>$HOME</span><span class=st>/.android"</span></a>
<a class=sourceLine data-line-number=2 id=cb1-2><span class=bu>export</span> <span class=va>PATH=</span><span class=st>"</span><span class=va>$ANDROID_HOME</span><span class=st>/tools:</span><span class=va>$ANDROID_HOME</span><span class=st>/tools/bin:</span><span class=va>$ANDROID_HOME</span><span class=st>/platform-tools:</span><span class=va>$PATH</span><span class=st>"</span></a></code></pre></div><p>Once were here, the installation is straightforward once we now which command to run.<div class=sourceCode id=cb2><pre class="sourceCode bash"><code class="sourceCode bash"><a class=sourceLine data-line-number=1 id=cb2-1><span class=ex>android</span> update sdk</a></code></pre></div><p>Then we must install some build tools.<div class=sourceCode id=cb3><pre class="sourceCode bash"><code class="sourceCode bash"><a class=sourceLine data-line-number=1 id=cb3-1><span class=ex>sdkmanager</span> <span class=st>"platforms;android-23"</span></a>
<a class=sourceLine data-line-number=2 id=cb3-2><span class=ex>sdkmanager</span> <span class=st>"build-tools;23.0.1"</span></a></code></pre></div><p>And also we must not forget to install all those <code>compat</code> libraries.<div class=sourceCode id=cb4><pre class="sourceCode bash"><code class="sourceCode bash"><a class=sourceLine data-line-number=1 id=cb4-1><span class=ex>sdkmanager</span> <span class=st>"extras;android;m2repository"</span></a></code></pre></div><p>And <em>voilà</em>!
4 changes: 2 additions & 2 deletions firefox-build-debootstrap.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!doctype html><meta charset=utf-8><title>make firefox-build-debootstrap.html</title><meta content="Thomas Duboucher" name=author><meta content="Thomas Duboucher, Serianox,blog" name=keywords><meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" name=viewport><h1 id=building-firefox-in-a-chroot>Building Firefox in a chroot</h1><p>Something I don't like is project with tons of build dependencies. They tend to stay and pollute the system. Something I don't like even more are containers.<p>Let's work with old school chroot.<h2 id=installing-dependencies>Installing dependencies</h2><pre><code>sudo aptitude install debootstrap schroot</code></pre><h2 id=installing-an-image>Installing an image</h2><p>A recent version of Ubuntu is enough.<pre><code>sudo debootstrap --variant=buildd arch=amd64 artful /srv/chroot/firefox-chroot http://archive.ubuntu.com/ubuntu/</code></pre><h2 id=configuring-and-starting-the-chroot>Configuring and starting the chroot</h2><pre><code>cat &lt;&lt;EOF > /etc/schroot/chroot.d/firefox.conf
<!doctype html><meta charset=utf-8><title>make</title><meta content="Thomas Duboucher" name=author><meta content="Thomas Duboucher, Serianox,blog" name=keywords><meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" name=viewport><link href=style.css rel=stylesheet><h1 id=building-firefox-in-a-chroot>Building Firefox in a chroot</h1><p>Something I don’t like is project with tons of build dependencies. They tend to stay and pollute the system. Something I don’t like even more are containers.<p>Let’s work with old school chroot.<h2 id=installing-dependencies>Installing dependencies</h2><pre><code>sudo aptitude install debootstrap schroot</code></pre><h2 id=installing-an-image>Installing an image</h2><p>A recent version of Ubuntu is enough.<pre><code>sudo debootstrap --variant=buildd arch=amd64 artful /srv/chroot/firefox-chroot http://archive.ubuntu.com/ubuntu/</code></pre><h2 id=configuring-and-starting-the-chroot>Configuring and starting the chroot</h2><pre><code>cat &lt;&lt;EOF > /etc/schroot/chroot.d/firefox.conf
[firefox]
description=Firefox
directory=/srv/chroot/firefox-chroot
Expand All @@ -15,4 +15,4 @@
sudo schroot -c firefox
apt-get update
apt-get install python clang
exit</code></pre><h2 id=starting-the-chroot> Starting the chroot</h2><pre><code>schroot -c firefox</code></pre><p>Now you can follow the <a href=https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Build_Instructions/Simple_Firefox_build/Linux_and_MacOS_build_preparation>official build steps</a>.
exit</code></pre><p>## Starting the chroot<pre><code>schroot -c firefox</code></pre><p>Now you can follow the <a href=https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Build_Instructions/Simple_Firefox_build/Linux_and_MacOS_build_preparation>official build steps</a>.
Loading

0 comments on commit b6491d7

Please sign in to comment.