Bubble Foundry


Posts tagged with: Javascript

Immutable Javascript
Something I quickly whipped up the other day, which you can find on GitHub as a Gist. Wish you had some immutability in Javascript? Now you can! var t = {a: 1, b: 2}.immutable(); console.log(t.a, t.b); try { t.a = 3; // -> Uncaught Error: a is immutable and cannot be modified. } catch (e) […] Read more – ‘Immutable Javascript’.
Backbone
One of the hot new Javascript libraries is Backbone.js, a sort of client-side MVC framework, so I decided to take it for a spin for Where’s My Bike. First, it also introduced me to Zepto, which I love. Second, its system of Models, Collections, and Views are quite powerful but it’s a real hassle to have […] Read more – ‘Backbone’.
Towards a Scala DSL for Javascript
Reposting from the Lift mailing list. For some time know I’ve been thinking about how cool it’d be to be able to essentially write Javascript but with all the Scala goodiness behind the scenes. Lift already has abstractions for more common Javascript language elements, so I have suspected that it could be used as the […] Read more – ‘Towards a Scala DSL for Javascript’.
The Facebook Login Button and logging into your webapp
Recently I’m been working on a single sign-on system (SSO, in the biz) and this week I added support for logging into the SSO via the Facebook Login Button. It’s cool that you can have a user log into you website using Facebook but as it stands there are a few… unfortunate… aspects to the system, all […] Read more – ‘The Facebook Login Button and logging into your webapp’.
jrunscript
I just learned about jrunscript, which is a Javascript console and interpreter distributed with Java 6, so chances are you already have it. In fact, it is a general purpose interpreter and you can select another language with the -l flag if it is in the classpath. The -q flag lists the currently installed languages. […] Read more – ‘jrunscript’.
PHP Closures
PHP 5.3 has added support for true anonymous functions and closures. Unfortunately, there are a few gotchas. The main one is that no variables are automatically enclosed: you must specify the variables you want to enclose. So, this will cause an exception: $a = 2; $f = function($i) { return $i + $a; } $f(1); […] Read more – ‘PHP Closures’.
regexInArray
Javascript arrays have an inArray() method that tests for the existence of a search object and returns its key. However, sometimes you don’t want to test for an exact match. I wrote a little function that will test a regex instead. Like inArray() it returns -1 if none of the elements satisfy the condition. function […] Read more – ‘regexInArray’.
MathPlus
I’ve been slowly assembling a set of common mathematical functions in a Javascript library called MathPlus. Tonight I added support for vectors. Check it out and let me know what you think. Read more – ‘MathPlus’.
Imajs
I made this a month or two ago but I forgot to mention it here: Jacob Biljnai of Tumblr was complaining on Twitter that there wasn’t a Javascript-based image resizing API so I made him one using App English, Imajs. Enjoy. Read more – ‘Imajs’.
HTML5 Video Transformation
This week I’ve been messing around with the HTML5 video element and have discovered you can do some pretty cool stuff. For instance, Mozilla shows how to do greenscreen image replacement while a video is played. This is very cool but there’s an annoying intermediate step required: since you cannot directly fetch raw frame image […] Read more – ‘HTML5 Video Transformation’.