Latest Posts

Showing 1 to 10 of 15 posts.

Creating command line tools with Node.js

March 15th, 2016    by sigman    1071
  Tips   nodejs, javascript, linux, programming

I needed to create an utility that when installed as a global module, it would be both available as a command line tool in bash and as a Node module that could be imported with require function from any Node script. As the command line tool, i wanted it to take input in two ways: take parameters and read input from a file or take piped streams. This tip explains how this can be achieved.

continue reading...

Markdown basics

July 23rd, 2013    by sigman    1725
  Primers   programming

Markdown has been made a markup language of choice by many different platforms including the one I use often: Github, Atlassian Jira, Stack Exchange. The language was designed to be readable as-is, without looking like it's been marked up with tags or formatting instructions (unlike HTML). Since its initial development in 2004 by John Gruber’s there have been number of efforts attempting to standarise it. John's own Perl script converting Markdown into HTML has been used as the initial definition for Markdown but since it has number of ambiguous definitions causing issues, many different standards of the language emerged. The differences are mainly around more advanced features thought and the base is rather common and this is what I'm going to concentrate on here. Also there is an inititiative called CommonMark (commonmark.org) describing itself as a strongly specified, highly compatible implementation of Markdown, with many popular individuals involved that standarises the language.

continue reading...

Using modules and dependency management in JavaScript applications with AMD - require.js

June 2nd, 2013    by sigman    1911
  Tutorials   programming, javascript

requirejs logoOne of the first things I had to learn when starting developing JavaScript applications was how to overcome lack of dependency management and concept of modules and namespaces. Unfortunately there are few JS books touching on these topics. When building large scale application, implementing hundreds of <script> tags becomes really hard to manage, especially when we need to keep them in specific order. Also the more script tags are included in the html files, the more requests a browser needs to do - this may cause a significant impact to the overall user experience - loading times, UI freezes... As JS lately became a language of choice for developing web applications targeting not only desktops but also mobile devices, developers needed to find a solution for that. Instead of waiting for changes to the JS specification (http://wiki.ecmascript.org/doku.php?id=harmony:modules) and for implementing that consequently to the popular browsers, they agreed for a standard that would be used both on server and client side and they named it CommonJS (http://wiki.commonjs.org/wiki/CommonJS). The solution works great with JS on the server side but due to the fact that files are loaded synchronously, it doesn't work well with browsers as this would block user interface during script load process. So the client side solution was modified for asynchronous loading by wrapping modules in files into callback functions. This is known as AMD - Asynchronous Module Definition
(https://github.com/amdjs/amdjs-api/wiki/AMD, http://requirejs.org/docs/whyamd.html). One of the most popular AMD loader solutions is the require.js and in this article we will look how to use it.

continue reading...

AGAL multitexture shader

September 5th, 2012    by sigman    4142
  Tutorials   actionscript, programming

Inspired by the great blog post from Devon_O on conversion of GLSL (OpenGL) shaders to AGAL shaders, I decided to pick one of the examples available on Shader Toy website and to my suprise it wasn't that hard to get it working. I wanted to put the example with code on the Wonderfl but I can't get it running over there so I decided to put it here. And while I put it here, why not add just few additional words about shaders in AGAL...

continue reading...

Regex basics

March 14th, 2012    by sigman    1475
  Primers   javascript, linux, RegEx

Regular expressions are patterns that can be matched against strings. They are used in many different situations and places. Most commonly regex come handy when doing operations on multiple files or working with strings like extracting specific values, validating forms, removing or replacing certain patterns like markup, splitting strings.

continue reading...

Box2D basics - Part 1

February 12th, 2012    by sigman    8075
  Primers   box2d, actionscript, programming

Box2D logoBox2D probably doesn't have to be introduced to anyone, even if you have never used it, you have probably still heard about it. This is the most popular physics simulation engine that has been ported to every popular platform available. I had a chance to work with Box2D in C++ and I have been reading tutorials from guys using it with Python, Objective-C, Java and JavaScript. So if you come from other platform than Flash, I encourage you to read this article anyway as although I'm using a Flash port here, everything works exactly the same way in other platforms. In the first part, I cover how to create a world, static and dynamic objects, how to add interaction and work with collision detection.

continue reading...

Saving and loading complex objects from a file with FlashPlayer

January 19th, 2012    by sigman    3392
  Tips   actionscript, programming

When building Flash apps or games there is very often a need to save some user data. It might be a player's progress in a game or some work done in an application. Usually online application data is being kept in a database and desktop apps are saving to a file on a hard drive. Flash also allows saving to shared objects, so called Flash's cookie files but there is a limit of size set by an operating system and some browsers or anti-viruses may clear them periodically effectively erasing users saved data. While for desktop apps developers choose Adobe AIR, which allows deeper integration with operating systems, not many people know that since Flash Player 10 there is also an option of saving and loading data from a file. In this quick article I will give you a code example of how this feature could be use along with JSON and ByteArrays to effectively save your data to a file.

continue reading...

Building iOS app with Adobe AIR - things learnt when developing ColorByShape app

December 1st, 2011    by sigman    29602
  Tips   actionscript, mobile

Color By Shape is my first app targeted for tablets only. Currently there is only iOS version available but the plan is to have it on Android Martket as well (it's pretty easy with AIR, just I don't have currently access to enough test devices). In this article I want to share some of the issues and ways of handling them when building an iPad app.

continue reading...