<?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>JS | Nerdpress.org</title>
	<atom:link href="https://nerdpress.org/category/js/feed/" rel="self" type="application/rss+xml" />
	<link>https://nerdpress.org</link>
	<description>...dev, tech problems and solutions.</description>
	<lastBuildDate>Fri, 12 Apr 2024 08:01:50 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<item>
		<title>Monorepo with NPM workspaces</title>
		<link>https://nerdpress.org/2024/04/12/monorepo-with-npm-workspaces/</link>
		
		<dc:creator><![CDATA[Ivo Bathke]]></dc:creator>
		<pubDate>Fri, 12 Apr 2024 08:01:50 +0000</pubDate>
				<category><![CDATA[JS]]></category>
		<category><![CDATA[node.js]]></category>
		<category><![CDATA[NPM]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Monorepo]]></category>
		<category><![CDATA[nodejs]]></category>
		<guid isPermaLink="false">https://nerdpress.org/?p=3300</guid>

					<description><![CDATA[<p>I recently converted a project into a Monorepo.I had a cli part and an Astro StaticSiteGenerator part. At some point I felt like these parts would be entangled too much so I decided to separate them. Since they were still related they should stay in one repo but have their own dependencies and separate processes. &#8230; </p>
<p class="link-more"><a href="https://nerdpress.org/2024/04/12/monorepo-with-npm-workspaces/" class="more-link">Continue reading<span class="screen-reader-text"> "Monorepo with NPM workspaces"</span></a></p>
The post <a href="https://nerdpress.org/2024/04/12/monorepo-with-npm-workspaces/">Monorepo with NPM workspaces</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></description>
										<content:encoded><![CDATA[<p>I recently converted a project into a Monorepo.<br />I had a cli part and an Astro StaticSiteGenerator part. <br />At some point I felt like these parts would be entangled too much so I decided to separate them. Since they were still related they should stay in one repo but have their own dependencies and separate processes. I still could have kept this in one Astro project with a cli folder but so it feels cleaner structured.</p>



<p>I chose NPM as my package manager since it comes bundled with node and so I decided to try out <a href="https://docs.npmjs.com/cli/v7/using-npm/workspaces" title="">NPM workspaces</a> as my MonoRepo approach.</p>



<p>So here are my takeaways</p>



<span id="more-3300"></span>



<p><strong>1.  Setup</strong></p>



<ul class="wp-block-list">
<li>The NPM workspaces Monorepo has one root dir with one package.json which defines the workspaces, but besides this it is more or less empty. The package.json defines a workspace directory which contains the sub projects. <br />As of now you can&#8217;t use <code>npm init</code> for this but have to create the main package.json manually.</li>
</ul>


<pre class="wp-block-code"><span><code class="hljs language-javascript">  <span class="hljs-string">"name"</span>: <span class="hljs-string">"workspaces-example"</span>,
  <span class="hljs-string">"workspaces"</span>: &#91;
    <span class="hljs-string">"packages/*"</span>
  ],</code></span></pre>


<figure class="wp-block-image size-full"><a href="https://nerdpress.org/wp-content/uploads/2024/04/npm-workspaces-directories.png"><img fetchpriority="high" decoding="async" width="258" height="210" src="https://nerdpress.org/wp-content/uploads/2024/04/npm-workspaces-directories.png" alt="" class="wp-image-3303"/></a></figure>



<ul class="wp-block-list">
<li>The sub projects each have their own package.json with all necessary dependencies for this specific project. The sub projects can be initialised by <code>npm init -w packages/cli</code></li>



<li>To add dependencies you can add the workspace to the <code>npm add</code> command and the dependency will be added to the respective package.json:<br /><code>npm add commander -w packages/cli</code><br />To install dependencies, run <code>npm i</code> from the root directory. This will install all deps of all workspaces in a node_modules folder in the root directory, but none in the projects in the workspaces folder. This already is a win because it will avoid having dependency duplettes.<br />However if you have conflicting versions of the same dependency in your packages, you will have a separate node_modules directory with the only the specific version for this single package.</li>
</ul>



<figure class="wp-block-image size-full"><a href="https://nerdpress.org/wp-content/uploads/2024/04/npm-workspaces-conflicting-versions-directories-1.png"><img decoding="async" width="272" height="354" src="https://nerdpress.org/wp-content/uploads/2024/04/npm-workspaces-conflicting-versions-directories-1.png" alt="" class="wp-image-3306" srcset="https://nerdpress.org/wp-content/uploads/2024/04/npm-workspaces-conflicting-versions-directories-1.png 272w, https://nerdpress.org/wp-content/uploads/2024/04/npm-workspaces-conflicting-versions-directories-1-231x300.png 231w" sizes="(max-width: 272px) 100vw, 272px" /></a></figure>



<p><br /><strong>2. Development</strong></p>



<ul class="wp-block-list">
<li>Updating dependencies can happen just like adding dependencies:<br /><kbd>npm update commander -w packages/cli</kbd></li>



<li>When you need different versions of a dependency in your workspaces, NPM will create a new node_modules folder in the one divergating workspace with only the dependency where you have the different version.</li>



<li>When you need to share code between workspaces you can import code from one package of the workspaces in another package just as a normal dependency from the NPM registry. <br />For example when you want to share types in a typescript project you can add a types workspace and just import in the other workspaces files. <br /><code>import {Name} from "types";</code></li>



<li>It is probably good practice to add shortcut scripts to your main package.json to run commands of your workspaces. So you don&#8217;t need to change to the workspaces directory, which is of course still possible.</li>
</ul>


<pre class="wp-block-code"><span><code class="hljs language-javascript">  <span class="hljs-string">"scripts"</span>: {
    <span class="hljs-string">"hello-cli"</span>: <span class="hljs-string">"npm --workspace=@workspaces-example/cli run hello"</span>,
    <span class="hljs-string">"hello-web"</span>: <span class="hljs-string">"npm --workspace=@workspaces-example/web run hello"</span>
  }
</code></span></pre>


<p><strong>3. Deploy</strong></p>



<ul class="wp-block-list">
<li>Deploying from a Monrepo needs to take the different packages into account, which need to be deployed separately but from the same CI config. <br />For Github Actions i used a path directive which changes to the package directory and runs instructions there. <br /><code>with: <br />  path: packages/astro</code></li>



<li>Other prefabricated actions like f.e. <kbd>actions/deploy-pages</kbd> have a <br /><kbd>working-directory: ./packages/astro</kbd> <br />directive which have the same effect.</li>
</ul>



<p>You can check out the example project here: <a href="https://github.com/ivoba/npm-workspaces-example" target="_blank" rel="noopener" title="">https://github.com/ivoba/npm-workspaces-example</a></p>



<p>One probably does not necessarily need a Monorepo for this example, but it is good to know that Monorepos are quite simple to achieve just with NPM, in case you need to.</p>The post <a href="https://nerdpress.org/2024/04/12/monorepo-with-npm-workspaces/">Monorepo with NPM workspaces</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Migrating from gulp to esbuild</title>
		<link>https://nerdpress.org/2021/07/23/migrating-from-gulp-to-esbuild/</link>
		
		<dc:creator><![CDATA[Ivo Bathke]]></dc:creator>
		<pubDate>Fri, 23 Jul 2021 15:06:46 +0000</pubDate>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Frontend]]></category>
		<category><![CDATA[JS]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[esbuild]]></category>
		<category><![CDATA[gulp]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[sass]]></category>
		<guid isPermaLink="false">https://nerdpress.org/?p=3066</guid>

					<description><![CDATA[<p>Esbuild is the new cool kid in the bundler world.It is super fast since its written in Go and comes with a lot of builtin features for modern frontend development. So i wanted to try it myself and migrated a former gulp build to esbuild. But as it showed the gulp build was not so &#8230; </p>
<p class="link-more"><a href="https://nerdpress.org/2021/07/23/migrating-from-gulp-to-esbuild/" class="more-link">Continue reading<span class="screen-reader-text"> "Migrating from gulp to esbuild"</span></a></p>
The post <a href="https://nerdpress.org/2021/07/23/migrating-from-gulp-to-esbuild/">Migrating from gulp to esbuild</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></description>
										<content:encoded><![CDATA[<p><a href="https://esbuild.github.io/" target="_blank" rel="noreferrer noopener">Esbuild</a> is the new cool kid in the bundler world.<br />It is super fast since its written in Go and comes with a lot of builtin features for modern frontend development.</p>



<p>So i wanted to try it myself and migrated a former <a href="https://gulpjs.com/" title="https://gulpjs.com/" target="_blank" rel="noreferrer noopener">gulp</a> build to esbuild.</p>



<p>But as it showed the gulp build was not so modern, as it was just Sass and Javascript minification. No ES6, No React, no JSX with inline styles.</p>



<p>So Esbuild was not working out of the box but needed some extra config and the <a href="https://www.npmjs.com/package/esbuild-plugin-sass" target="_blank" rel="noreferrer noopener">Sass plugin</a>.</p>



<p><code>npm i -d esbuild esbuild-plugin-sass</code></p>



<p>Also I had to rewrite the Javascript to use ES6 modules, but this was fortunatly easy.</p>



<span id="more-3066"></span>



<p>When using a plugin we need to create our own build file and configure esbuild to use the Sass plugin.<br />esbuild.js:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: jscript; title: ; notranslate">
const esbuild = require(&#039;esbuild&#039;);
const sassPlugin = require(&#039;esbuild-plugin-sass&#039;);

esbuild.build({
  entryPoints: &#x5B;&quot;main.js&quot;],
  bundle: true,
  minify: true,
  format: &#039;iife&#039;,
  platform: &#039;browser&#039;,
  outfile:&quot;main.min.js&quot;,
  plugins: &#x5B;sassPlugin()]
}).catch((err) =&gt; {
  console.log(err)
})
</pre></div>


<p>Ok, but where are the Sass files now?<br />With ES6 you can import styles and then esbuild &amp; the sassPlugin can follow this path from the entrypoint file and create the CSS file from the source Sass file.</p>



<p>So in main.js import the styles:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: jscript; title: ; notranslate">
import $ from &#039;jquery&#039;
import &#039;./style.scss&#039;
...
</pre></div>


<p>Now you can call the esbuild.js file:</p>



<p><code>node ./esbuild.js</code></p>



<p><em>(Yeah no file watchers here, just manual trigger ;))</em></p>



<p>This will bundle the javascript to main.min.js and also create a main.min.css file.</p>



<p>Then include this in your HTML</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: xml; title: ; notranslate">
&lt;link rel=&quot;stylesheet&quot; href=&quot;/main.min.css&quot;&gt; 
&lt;script src=&quot;/main.min.js&quot;&gt;&lt;/script&gt;
</pre></div>


<p>and you are done. :)</p>The post <a href="https://nerdpress.org/2021/07/23/migrating-from-gulp-to-esbuild/">Migrating from gulp to esbuild</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>bower, require.js, masonry &#038; imagesloaded</title>
		<link>https://nerdpress.org/2014/01/28/bower-require-js-masonry-imagesloaded/</link>
		
		<dc:creator><![CDATA[Ivo Bathke]]></dc:creator>
		<pubDate>Tue, 28 Jan 2014 17:02:42 +0000</pubDate>
				<category><![CDATA[JS]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[bower]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[masonry]]></category>
		<category><![CDATA[requirejs]]></category>
		<guid isPermaLink="false">https://nerdpress.org/?p=2519</guid>

					<description><![CDATA[<p>Wanna run masonry with imagesloaded in require.js, powered by bower? Try this gist! First create your bower.json file and run bower install Then configure require.js and then code the app: Its scrabbled together from http://masonry.desandro.com/appendix.html and various StackOverflow posts.</p>
The post <a href="https://nerdpress.org/2014/01/28/bower-require-js-masonry-imagesloaded/">bower, require.js, masonry & imagesloaded</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></description>
										<content:encoded><![CDATA[<p>Wanna run <a href="http://masonry.desandro.com/" target="_blank">masonry</a> with <a href="https://github.com/desandro/imagesloaded" target="_blank">imagesloaded</a> in <a href="http://www.requirejs.org/" target="_blank">require.js</a>, powered by <a href="http://bower.io" target="_blank">bower</a>?</p>
<p>Try this <a href="https://gist.github.com/ivoba/7097270" target="_blank">gist</a>!</p>
<p>First create your bower.json file and run <strong>bower install</strong><br />
<script src="https://gist.github.com/7097270.js?file=bower.json"></script><noscript><pre><code class="language-json json">{
  &quot;name&quot;: &quot;bower-masonry-imagesloaded-requirejs&quot;,
  &quot;version&quot;: &quot;0.0.0&quot;,
  &quot;dependencies&quot;: {
    &quot;requirejs&quot;: &quot;~2.1.8&quot;,
    &quot;jquery&quot;: &quot;~1.10.2&quot;,
    &quot;masonry&quot;: &quot;~3.1.2&quot;,
    &quot;imagesloaded&quot;: &quot;~3.0.4&quot;
  }
}</code></pre></noscript></p>
<p><span id="more-2519"></span></p>
<p>Then configure require.js<br />
<script src="https://gist.github.com/7097270.js?file=main.js"></script><noscript><pre><code class="language-javascript javascript">require.config({
    paths: {
        jquery: &#039;../bower_components/jquery/jquery&#039;,
        eventie: &#039;../bower_components/eventie&#039;,
        &#039;doc-ready&#039;: &#039;../bower_components/doc-ready&#039;,
        eventEmitter: &#039;../bower_components/eventEmitter&#039;,
        &#039;get-style-property&#039;: &#039;../bower_components/get-style-property&#039;,
        &#039;get-size&#039;: &#039;../bower_components/get-size&#039;,
        &#039;matches-selector&#039;: &#039;../bower_components/matches-selector&#039;,
        outlayer: &#039;../bower_components/outlayer&#039;,
        masonry: &#039;../bower_components/masonry&#039;,
        imagesloaded: &#039;../bower_components/imagesloaded&#039;
    }
});</code></pre></noscript></p>
<p>and then code the app:<br />
<script src="https://gist.github.com/7097270.js?file=app.js"></script><noscript><pre><code class="language-javascript javascript">define([&#039;masonry/masonry&#039;, &#039;imagesloaded/imagesloaded&#039;], function(Masonry, imagesLoaded) {
    $(document).ready(function() {
        var container = document.querySelector(&#039;#masonry&#039;);
        imagesLoaded(container, function() {
           var msnry = new Masonry(container, {
               columnWidth: 200,
                gutter: 20,
                itemSelector: &#039;.item&#039;,
                isFitWidth: true
           });
             
       });
    });
});</code></pre></noscript></p>
<p>Its scrabbled together from <a href="http://masonry.desandro.com/appendix.html">http://masonry.desandro.com/appendix.html</a> and various StackOverflow posts.</p>The post <a href="https://nerdpress.org/2014/01/28/bower-require-js-masonry-imagesloaded/">bower, require.js, masonry & imagesloaded</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>JSfiddle Bookmarklet Generator with jQuery &#038; Codemirror</title>
		<link>https://nerdpress.org/2013/03/08/jsfiddle-bookmarklet-generator-with-jquery-codemirror/</link>
					<comments>https://nerdpress.org/2013/03/08/jsfiddle-bookmarklet-generator-with-jquery-codemirror/#comments</comments>
		
		<dc:creator><![CDATA[Max Girkens]]></dc:creator>
		<pubDate>Fri, 08 Mar 2013 11:41:59 +0000</pubDate>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[JS]]></category>
		<category><![CDATA[bookmarklet]]></category>
		<category><![CDATA[CodeMirror]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jsfiddle]]></category>
		<guid isPermaLink="false">https://nerdpress.org/?p=2410</guid>

					<description><![CDATA[<p>This is a little bookmarklet generator i put together this morning: http://jsfiddle.net/QMeuV/1/embedded/result/ Its hosted on jsfiddle.net and enables you to create Bookmarklets which use jQuery based on the code i found here: http://coding.smashingmagazine.com/2010/05/23/make-your-own-bookmarklets-with-jquery/ It also features Javascript Syntax Highlighting using http://codemirror.net/. *UPDATE* this tool now (also) lives on https://github.com/gherkins/bookmarklet-generator</p>
The post <a href="https://nerdpress.org/2013/03/08/jsfiddle-bookmarklet-generator-with-jquery-codemirror/">JSfiddle Bookmarklet Generator with jQuery & Codemirror</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></description>
										<content:encoded><![CDATA[<p>This is a little bookmarklet generator i put together this morning:</p>
<p><a href="http://jsfiddle.net/QMeuV/1/embedded/result/">http://jsfiddle.net/QMeuV/1/embedded/result/<span id="more-2410"></span></a></p>
<p><a href="https://nerdpress.org/wp-content/uploads/2013/03/Bildschirmfoto-2013-03-08-um-12.24.55.png"><img decoding="async" class="alignnone size-medium wp-image-2411" alt="Bildschirmfoto 2013-03-08 um 12.24.55" src="https://nerdpress.org/wp-content/uploads/2013/03/Bildschirmfoto-2013-03-08-um-12.24.55-300x224.png" width="300" height="224" srcset="https://nerdpress.org/wp-content/uploads/2013/03/Bildschirmfoto-2013-03-08-um-12.24.55-300x224.png 300w, https://nerdpress.org/wp-content/uploads/2013/03/Bildschirmfoto-2013-03-08-um-12.24.55-1024x767.png 1024w, https://nerdpress.org/wp-content/uploads/2013/03/Bildschirmfoto-2013-03-08-um-12.24.55.png 1559w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p>Its hosted on <a href="http://jsfiddle.net/">jsfiddle.net</a> and enables you to create Bookmarklets which use jQuery based on the code i found here:<br />
<a href="http://coding.smashingmagazine.com/2010/05/23/make-your-own-bookmarklets-with-jquery/">http://coding.smashingmagazine.com/2010/05/23/make-your-own-bookmarklets-with-jquery/</a></p>
<p>It also features Javascript Syntax Highlighting using <a href="http://codemirror.net/">http://codemirror.net/</a>.</p>
<p>*UPDATE*<br />
this tool now (also) lives on <a href="https://github.com/gherkins/bookmarklet-generator">https://github.com/gherkins/bookmarklet-generator</a></p>The post <a href="https://nerdpress.org/2013/03/08/jsfiddle-bookmarklet-generator-with-jquery-codemirror/">JSfiddle Bookmarklet Generator with jQuery & Codemirror</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></content:encoded>
					
					<wfw:commentRss>https://nerdpress.org/2013/03/08/jsfiddle-bookmarklet-generator-with-jquery-codemirror/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>mashcloud.net &#8211; mashup soundcloud audio tracks</title>
		<link>https://nerdpress.org/2013/01/24/mashcloud-net-mashup-soundcloud-audio-tracks/</link>
		
		<dc:creator><![CDATA[Max Girkens]]></dc:creator>
		<pubDate>Thu, 24 Jan 2013 20:08:28 +0000</pubDate>
				<category><![CDATA[API]]></category>
		<category><![CDATA[Express]]></category>
		<category><![CDATA[Frontend]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[JS]]></category>
		<category><![CDATA[node.js]]></category>
		<category><![CDATA[socket.io]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[sockets]]></category>
		<category><![CDATA[soundcloud]]></category>
		<guid isPermaLink="false">https://nerdpress.org/?p=2359</guid>

					<description><![CDATA[<p>mashcloud.net is an experiment on collaborative realtime audio editing and music creation. I did the project within the frame of  my BA thesis in audio production last year. As I moved the code to github this week, I wanted to give a quick overview of the project and its technical underlyings, just in case someone might &#8230; </p>
<p class="link-more"><a href="https://nerdpress.org/2013/01/24/mashcloud-net-mashup-soundcloud-audio-tracks/" class="more-link">Continue reading<span class="screen-reader-text"> "mashcloud.net &#8211; mashup soundcloud audio tracks"</span></a></p>
The post <a href="https://nerdpress.org/2013/01/24/mashcloud-net-mashup-soundcloud-audio-tracks/">mashcloud.net – mashup soundcloud audio tracks</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></description>
										<content:encoded><![CDATA[<p><a href="http://mashcloud.net/">mashcloud.net</a> is an experiment on collaborative realtime audio editing and music creation. <br />I did the project within the frame of  my BA thesis in audio production last year.</p>
<p>As I moved the code to <a href="https://github.com/gherkins/mashcloud">github</a> this week, I wanted to give a quick overview of the project and its technical underlyings, just in case someone might be interested :)</p>
<p><span id="more-2359"></span>As the title of this post might already suggest, its about selecting and layering loops from audiofiles hosted on <a href="http://soundcloud.com">soundcloud.com</a> and thereby creating new music.</p>
<p><a href="https://nerdpress.org/2013/01/24/mashcloud-net-mashup-soundcloud-audio-tracks/bildschirmfoto-2013-01-24-um-20-46-08/" rel="attachment wp-att-2363"><img decoding="async" class="alignnone size-medium wp-image-2363" alt="Bildschirmfoto 2013-01-24 um 20.46.08" src="https://nerdpress.org/wp-content/uploads/2013/01/Bildschirmfoto-2013-01-24-um-20.46.08-300x174.png" width="300" height="174" srcset="https://nerdpress.org/wp-content/uploads/2013/01/Bildschirmfoto-2013-01-24-um-20.46.08-300x174.png 300w, https://nerdpress.org/wp-content/uploads/2013/01/Bildschirmfoto-2013-01-24-um-20.46.08-1024x593.png 1024w, https://nerdpress.org/wp-content/uploads/2013/01/Bildschirmfoto-2013-01-24-um-20.46.08.png 1050w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p>Those collections of layered loops are called a session. Sessions can be created anonymously by everyone and are auto-saved on every action. By distributing the URL of a session other users can join and every action is synced between all users in realtime. <br />(complete mayhem, indeed :)</p>
<p>The application is built with HTML5 and JS w/ <a href="http://jquery.com/">jQuery</a> using the <a href="http://developers.soundcloud.com/docs/api/guide">soundcloud API</a> on the client side and runs on <a href="http://nodejs.org/">node.js</a> &amp; <a href="http://www.mongodb.org/">mongoDB</a> with <a href="http://expressjs.com/">express</a>, <a href="http://socket.io/">socket.io</a> and <a href="http://mongoosejs.com/">mongoose</a> on the server side.</p>
<p>I basically started the project to find out if you could play multiple loops asynchronous and synced with low latency using the <a href="https://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html">Web Audio API</a> while collaboratively working together with multiple users in realtime. </p>
<p>As that turned out to be not only possible but performed real nicely, the experiment then developed in somewhat of an application and finally got a name and a face.</p>
<p>There&#8217;s a whole lot of things i&#8217;d like to implement / refactor and do when i get some time on my hands, as</p>
<p>&#8211; adding a &#8220;record&#8221; feature to record, save and export created sessions as audiofiles</p>
<p>&#8211; rewriting the client side with <a href="http://backbonejs.org/">backbone.js</a> (as things got a bit messy &#8230;)</p>
<p>&#8211; adding some audio effects to the tracks</p>
<p>&#8211; write some tests</p>
<p>I&#8217;d appreciate any form of contribution as much as any questions or feedback on the project :)</p>
<p>Feel free to check out the live version at <a href="http://mashcloud.net/"> http://mashcloud.net/</a> or the sources at <a href="https://github.com/gherkins/mashcloud">https://github.com/gherkins/mashcloud</a></p>The post <a href="https://nerdpress.org/2013/01/24/mashcloud-net-mashup-soundcloud-audio-tracks/">mashcloud.net – mashup soundcloud audio tracks</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>[Symfony 2][Assetic] Sass, CompassFilter + Foundation Responsive Front-end Framework</title>
		<link>https://nerdpress.org/2012/10/26/symfony-2assetic-sass-compassfilter-foundation-responsive-front-end-framework/</link>
					<comments>https://nerdpress.org/2012/10/26/symfony-2assetic-sass-compassfilter-foundation-responsive-front-end-framework/#comments</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Fri, 26 Oct 2012 15:32:56 +0000</pubDate>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Frontend]]></category>
		<category><![CDATA[JS]]></category>
		<category><![CDATA[Silex]]></category>
		<category><![CDATA[Symfony]]></category>
		<category><![CDATA[Tools]]></category>
		<guid isPermaLink="false">https://nerdpress.org/?p=2323</guid>

					<description><![CDATA[<p>Did you ever wonder how to enable 3rd party plugins (or so called &#8220;frameworks&#8220;) within the great compass toolset managed by assetic in your edgy symfony 2.1 project? (If there is more extensive documentation available concerning assetic + CompassFilter, please stop reading on and let me know!) If you take a look at the filter &#8230; </p>
<p class="link-more"><a href="https://nerdpress.org/2012/10/26/symfony-2assetic-sass-compassfilter-foundation-responsive-front-end-framework/" class="more-link">Continue reading<span class="screen-reader-text"> "[Symfony 2][Assetic] Sass, CompassFilter + Foundation Responsive Front-end Framework"</span></a></p>
The post <a href="https://nerdpress.org/2012/10/26/symfony-2assetic-sass-compassfilter-foundation-responsive-front-end-framework/">[Symfony 2][Assetic] Sass, CompassFilter + Foundation Responsive Front-end Framework</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></description>
										<content:encoded><![CDATA[<p>Did you ever wonder how to enable 3rd <a href="http://compass-style.org/frameworks/">party</a> plugins (or so called &#8220;<a href="http://compass-style.org/frameworks/">frameworks</a>&#8220;) within the great <a href="http://compass-style.org/">compass toolset</a> managed by <a href="https://github.com/kriswallsmith/assetic">assetic</a> in your edgy <a href="http://symfony.com/">symfony 2.1</a> project?</p>
<p>(If there is more extensive documentation available concerning assetic + CompassFilter, please stop reading on and let me know!)</p>
<p>If you take a look at the filter class itself (it is CompassFilter in the generic Assetic\Filter namespace), you should recognise several option values that you can use in your application wide config.yml file.</p>
<p>But first you have to install the framework plugin following these <a href="http://foundation.zurb.com/docs/gem-install.php">instructions</a>.</p>
<p><span id="more-2323"></span></p>
<p>After adding the framework plugin by ruby&#8217;s own package manager &#8220;gem&#8221; (hopefully replaced by composer in the near future ;-)) by typing something like</p>
<pre class="brush: bash; title: ; notranslate">$ gem install zurb-foundation</pre>
<p>the only thing remaining to do is to load the framework plugin by assetic. To do so, put the folloging lines to your config.yml assetic section (as you would do it when using the compass command line interface, refer to the output of</p>
<pre class="brush: bash; title: ; notranslate">$ compass help compile</pre>
<p>.)</p>
<p>The yaml file should look like this:</p>
<pre class="brush: python; title: ; notranslate">
assetic:
    read_from: %kernel.root_dir%/web
    debug: %kernel.debug%
    use_controller: %kernel.debug%
    filters:
        compass:
            plugins: &#x5B;'zurb-foundation'] 
            # load foundation                                     
            # framework as you would do by typing
            # $ compass compile --require 
            # zurb-foundation &#x5B;...]
            # &#x5B; ... ]
</pre>
<p>Now you should be able to import the foundation library files by using the @import statement in your *.sass/*.scss files:</p>
<pre class="brush: css; title: ; notranslate">
@import &quot;foundation&quot;;
</pre>
<p>Have fun!</p>The post <a href="https://nerdpress.org/2012/10/26/symfony-2assetic-sass-compassfilter-foundation-responsive-front-end-framework/">[Symfony 2][Assetic] Sass, CompassFilter + Foundation Responsive Front-end Framework</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></content:encoded>
					
					<wfw:commentRss>https://nerdpress.org/2012/10/26/symfony-2assetic-sass-compassfilter-foundation-responsive-front-end-framework/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>Hosting multiple Express (node.js) apps on port 80</title>
		<link>https://nerdpress.org/2012/04/20/hosting-multiple-express-node-js-apps-on-port-80/</link>
					<comments>https://nerdpress.org/2012/04/20/hosting-multiple-express-node-js-apps-on-port-80/#comments</comments>
		
		<dc:creator><![CDATA[Max Girkens]]></dc:creator>
		<pubDate>Fri, 20 Apr 2012 03:40:31 +0000</pubDate>
				<category><![CDATA[Admin]]></category>
		<category><![CDATA[Express]]></category>
		<category><![CDATA[node.js]]></category>
		<category><![CDATA[socket.io]]></category>
		<category><![CDATA[vServer]]></category>
		<category><![CDATA[express]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[proxy]]></category>
		<category><![CDATA[sockets]]></category>
		<guid isPermaLink="false">https://nerdpress.org/?p=2144</guid>

					<description><![CDATA[<p>In the last days, i was trying to find a solution hosting multiple Express apps on my vServer the same Server. Starting with Apache and mod_proxy, i ended up with a plain node solution, which i really like. Let&#8217;s take a quick look on some different approaches out there: &#8212;1&#8212; Using apache on port 80 &#8230; </p>
<p class="link-more"><a href="https://nerdpress.org/2012/04/20/hosting-multiple-express-node-js-apps-on-port-80/" class="more-link">Continue reading<span class="screen-reader-text"> "Hosting multiple Express (node.js) apps on port 80"</span></a></p>
The post <a href="https://nerdpress.org/2012/04/20/hosting-multiple-express-node-js-apps-on-port-80/">Hosting multiple Express (node.js) apps on port 80</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></description>
										<content:encoded><![CDATA[<p>In the last days, i was trying to find a solution hosting multiple <a href="http://expressjs.com/">Express</a> apps on <del datetime="2012-04-19T00:40:35+00:00">my vServer </del>the same Server.</p>
<p>Starting with <a href="http://www.apache.org/">Apache</a> and <a href="http://httpd.apache.org/docs/2.0/mod/mod_proxy.html">mod_proxy</a>, i ended up with a plain node solution, which i really like.<span id="more-2144"></span></p>
<p><a href="https://nerdpress.org/wp-content/uploads/2012/04/node-http-proxy-haz-colors.png"><img decoding="async" class="alignnone size-full wp-image-2146" title="node-http-proxy-haz-colors" src="https://nerdpress.org/wp-content/uploads/2012/04/node-http-proxy-haz-colors.png" alt="" width="527" height="106" srcset="https://nerdpress.org/wp-content/uploads/2012/04/node-http-proxy-haz-colors.png 527w, https://nerdpress.org/wp-content/uploads/2012/04/node-http-proxy-haz-colors-300x60.png 300w" sizes="(max-width: 527px) 100vw, 527px" /></a></p>
<p>Let&#8217;s take a quick look on some different approaches out there:</p>
<p><strong>&#8212;1&#8212;</strong></p>
<p>Using apache on port 80 as a proxy</p>
<pre class="brush: bash; title: ; notranslate">
ProxyPass /nodeurls/ http://localhost:9000/
ProxyPassReverse /nodeurls/ http://localhost:9000/
</pre>
<p>via <a href="http://stackoverflow.com/questions/6109089/how-do-i-run-node-js-on-port-80">stackoverflow</a></p>
<p>&#8212; no websockets<br />
++ probably the easiest way to integrate with your running AMPP-stack</p>
<p><strong>&#8212;2&#8212;</strong></p>
<p>Using a node.js app on port 80 as a Wrapper for other node apps.</p>
<pre class="brush: jscript; title: ; notranslate">
express.createServer()
  .use(express.vhost('hostname1.com', require('/path/to/hostname1').app)
  .use(express.vhost('hostname2.com', require('/path/to/hostname2').app)
.listen(80)
</pre>
<p>via <a href="http://stackoverflow.com/questions/9332865/how-should-i-organize-multiple-express-servers-on-the-same-system">stackoverflow</a></p>
<p>++ you can use websockets on port 80<br />
&#8212; apps crash/restart/stop globally<br />
&#8211;what about your apache or the like?</p>
<p><strong>&#8212;3&#8212;</strong></p>
<p>Using node.js with node-http-proxy on port 80</p>
<pre class="brush: jscript; title: ; notranslate">
var http = require('http')
, httpProxy = require('http-proxy');

httpProxy.createServer({
  hostnameOnly: true,
  router: {
    //web-development.cc
    'www.my-domain.com': '127.0.0.1:3001',
    'www.my-other-domain.de' : '127.0.0.1:3002'
  }
}).listen(80);

</pre>
<p>++ proxy websockets to any port<br />
&#8212; you might need to move your old web server to another port</p>
<p>The really cool thing about using node-http-proxy is its capability of proxying websockets.<br />
So you can have your apps running independtly on different ports while serving everything to the user over port 80 and use stuff like <a href="http://socket.io/">socket.io</a>.</p>
<p>Since i&#8217;m new to node.js and miles away from beeing a admin, any feedback is highly appreciated :)</p>The post <a href="https://nerdpress.org/2012/04/20/hosting-multiple-express-node-js-apps-on-port-80/">Hosting multiple Express (node.js) apps on port 80</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></content:encoded>
					
					<wfw:commentRss>https://nerdpress.org/2012/04/20/hosting-multiple-express-node-js-apps-on-port-80/feed/</wfw:commentRss>
			<slash:comments>14</slash:comments>
		
		
			</item>
		<item>
		<title>javascript benchmarking with jsperf</title>
		<link>https://nerdpress.org/2012/04/11/javascript-benchmarking-with-jsperf/</link>
		
		<dc:creator><![CDATA[Ivo Bathke]]></dc:creator>
		<pubDate>Wed, 11 Apr 2012 15:18:31 +0000</pubDate>
				<category><![CDATA[JS]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<guid isPermaLink="false">https://nerdpress.org/?p=2139</guid>

					<description><![CDATA[<p>I might be a bit late (yeaikno it exist over a year now and a bunch of blogs had it covered) but nevertheless i would like to point out a very helpful online tool i recently ran into: jsPerf Its basically a online benchmark tool for testing different approaches in javascript. It covers some important &#8230; </p>
<p class="link-more"><a href="https://nerdpress.org/2012/04/11/javascript-benchmarking-with-jsperf/" class="more-link">Continue reading<span class="screen-reader-text"> "javascript benchmarking with jsperf"</span></a></p>
The post <a href="https://nerdpress.org/2012/04/11/javascript-benchmarking-with-jsperf/">javascript benchmarking with jsperf</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></description>
										<content:encoded><![CDATA[<p>I might be a bit late <del datetime="2012-04-11T15:12:28+00:00">(yeaikno it exist over a year now and a bunch of blogs had it covered)</del> but nevertheless i would like to point out a very helpful online tool i recently ran into:</p>
<p><a href="http://jsperf.com" target="_blank">jsPerf</a></p>
<p>Its basically a online benchmark tool for testing different approaches in javascript.<br />
It covers some important aspects of benchmarking, that your homemade bench probably wont have like milliseconds accuracy &#038; statistical analysis.<br />
The tests are run on your browser and the results will feed the &#8220;browserscope&#8221;. A graph of the &#8220;highest known results&#8221; for the participating browsers.<br />
So we can see some kind of comparison.<br />
<span id="more-2139"></span><br />
Almost all classic concurrent approaches are covered, my favorites are:</p>
<p><a href="http://jsperf.com/string-concatenation/14" target="_blank">String concatenation</a></p>
<p><a href="http://jsperf.com/javascript-template-engine/3" target="_blank">JavaScript Template Engines</a>, in this revision its: juicer, mustache, ejohn, kissy, nTenjin<br />
( yes it has revisions :) )</p>
<p><a href="http://jsperf.com/switchclass-or-removeclass-and-addclass" target="_blank">switchClass OR removeClass and addClass</a></p>
<p><a href="http://jsperf.com/jquery-remove-class-selector" target="_blank">fastest jQuery selectors to remove class</a></p>
<p>See if you can find some, you struggled with lately:<br />
<a href="http://jsperf.com/browse" target="_blank">http://jsperf.com/browse</a></p>
<p>JsPerf has some further interesting options like<br />
<strong>autorun</strong><br />
<em>append #run to the URL of the test case</em></p>
<p><strong>filters</strong> for the browserscope<br />
<em>filters are: popular, all, desktop, family, major, minor, mobile, prerelease</em></p>
<p><strong>chart types</strong> of browserscope<br />
<em>append #chart=table to the test case’s URL<br />
types are: bar(default), table, column, line, and pie</em></p>
<p>Give it a try, daily!</p>The post <a href="https://nerdpress.org/2012/04/11/javascript-benchmarking-with-jsperf/">javascript benchmarking with jsperf</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Tools for jade template development</title>
		<link>https://nerdpress.org/2012/04/09/tools-for-jade-template-development/</link>
		
		<dc:creator><![CDATA[Max Girkens]]></dc:creator>
		<pubDate>Mon, 09 Apr 2012 10:12:01 +0000</pubDate>
				<category><![CDATA[Express]]></category>
		<category><![CDATA[JS]]></category>
		<category><![CDATA[node.js]]></category>
		<category><![CDATA[express]]></category>
		<category><![CDATA[jade]]></category>
		<guid isPermaLink="false">https://nerdpress.org/?p=2132</guid>

					<description><![CDATA[<p>I recently started digging into node.js and the express framework. One thing i like about it is that it comes with the beautiful jade template engine by default. Here are some things that come real hany when you are working with jade. This one really saved my mental health in more than one case. Just &#8230; </p>
<p class="link-more"><a href="https://nerdpress.org/2012/04/09/tools-for-jade-template-development/" class="more-link">Continue reading<span class="screen-reader-text"> "Tools for jade template development"</span></a></p>
The post <a href="https://nerdpress.org/2012/04/09/tools-for-jade-template-development/">Tools for jade template development</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></description>
										<content:encoded><![CDATA[<p>I recently started digging into <a href="http://nodejs.org/">node.js</a> and the <a href="http://expressjs.com/">express framework</a>.<br />
One thing i like about it is that it comes with the beautiful <a href="http://jade-lang.com/">jade template engine</a> by default.</p>
<p>Here are some things that come real hany when you are working with jade.<span id="more-2132"></span></p>
<p>This one really saved my mental health in more than one case.<br />
Just paste your HTML and you get nice and clean jade code:</p>
<p><a href="http://html2jade.aaron-powell.com/">http://html2jade.aaron-powell.com/</a></p>
<p>If you are using Netbeans, make sure you don&#8217;t miss to install the beautifully working plugin for .jade files.</p>
<p><a href="https://github.com/lumenlunae/jade-netbeans-syntax-highlighting">https://github.com/lumenlunae/jade-netbeans-syntax-highlighting</a></p>
<p>If you are developing in PHP and want to check out jade anyway, check this out:</p>
<p><a href="https://nerdpress.org/wp-content/uploads/2012/04/php_jade.jpg"><img decoding="async" class="alignnone size-full wp-image-2135" title="php_jade" src="https://nerdpress.org/wp-content/uploads/2012/04/php_jade.jpg" alt="" width="293" height="238" /></a></p>
<p>No seriously, check THIS:</p>
<p><a href="https://github.com/everzet/jade.php">https://github.com/everzet/jade.php</a></p>The post <a href="https://nerdpress.org/2012/04/09/tools-for-jade-template-development/">Tools for jade template development</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>run JavaScript code in PHP 5.3 with the v8js extension</title>
		<link>https://nerdpress.org/2012/03/09/run-javascript-code-in-php-5-3-with-the-v8js-extension/</link>
		
		<dc:creator><![CDATA[Max Girkens]]></dc:creator>
		<pubDate>Thu, 08 Mar 2012 23:14:10 +0000</pubDate>
				<category><![CDATA[JS]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[homebrew]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[pecl]]></category>
		<category><![CDATA[v8js.so]]></category>
		<guid isPermaLink="false">https://nerdpress.org/?p=2102</guid>

					<description><![CDATA[<p>&#8230;for some reason i needed to get t h i s to work before going to sleep. I&#8217;m running OSX 10.7.3 with macports which usually does the job, but  Google&#8217;s V8 Javascript Engine is not available as a port yet. So&#8230; homebrew to the rescue: installed it: /usr/bin/ruby -e &#34;$(/usr/bin/curl -fsSL https://raw.github.com/gist/323731)&#34; and installed v8 &#8230; </p>
<p class="link-more"><a href="https://nerdpress.org/2012/03/09/run-javascript-code-in-php-5-3-with-the-v8js-extension/" class="more-link">Continue reading<span class="screen-reader-text"> "run JavaScript code in PHP 5.3 with the v8js extension"</span></a></p>
The post <a href="https://nerdpress.org/2012/03/09/run-javascript-code-in-php-5-3-with-the-v8js-extension/">run JavaScript code in PHP 5.3 with the v8js extension</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></description>
										<content:encoded><![CDATA[<p>&#8230;for some reason i needed to get <strong><a href="http://php.net/manual/en/book.v8js.php">t h i s</a></strong> to work before going to sleep.</p>
<p>I&#8217;m running OSX 10.7.3 with <a href="http://www.macports.org/">macports</a> which usually does the job, but  <a href="http://code.google.com/p/v8/">Google&#8217;s V8 Javascript Engine</a> is not available as a port yet.<span id="more-2102"></span></p>
<p>So&#8230; <a href="http://mxcl.github.com/homebrew/">homebrew</a> to the rescue:</p>
<p>installed it:</p>
<pre class="brush: bash; title: ; notranslate">
/usr/bin/ruby -e &quot;$(/usr/bin/curl -fsSL https://raw.github.com/gist/323731)&quot;
</pre>
<p>and installed v8</p>
<pre class="brush: bash; title: ; notranslate">
brew install v8
</pre>
<p>wait, this seems <a href="http://www.youtube.com/watch?v=jWI8w9kLAks">too easy</a>.</p>
<p>PECL installed some beta version of the PHP extension.</p>
<pre class="brush: bash; title: ; notranslate">
sudo pecl install channel://pecl.php.net/v8js-0.1.2
</pre>
<p>added</p>
<pre class="brush: bash; title: ; notranslate">extension=v8js.so</pre>
<p>to the php.ini file.</p>
<p>und bitteschön:</p>
<pre class="brush: php; title: ; notranslate">

$v8 = new V8Js();
var_dump($v8-&gt;executeString(&quot;

//hey i'm Javascript Code

//INSIDE PHP !

//wow.
var hello = 'Hallo';

function helloWorld( string ){
return hello + ' ' + string;
}

helloWorld('World');

&quot;));

</pre>
<p>Such things might come in handy one day, <a href="https://plus.google.com/115423703838305233565/posts/VtskgWhB3kV">you know</a>.</p>The post <a href="https://nerdpress.org/2012/03/09/run-javascript-code-in-php-5-3-with-the-v8js-extension/">run JavaScript code in PHP 5.3 with the v8js extension</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
