htwjw
htwjw
Web Stuff
53 posts
Random rantings of web development, Javascript, PHP and NodeJS thoughts.
Don't wanna be here? Send us removal request.
htwjw 10 years ago
Text
Using use in PHP
A rather obscure quirk of PHP is the use聽keyword - not for namespace importing, but as a way to selectively import variables from the defining location into anonymous functions. If that doesn't mean much to you, check out this post. Go on, I'll wait.
Good, now that you got that, I would like to continue with a little note of my own: basically, it's (also) a way to curry in variables that you don't want to have to specify when calling the function, but still want available, much like currying in Javascript et al.
Just my 2垄...
0 notes
htwjw 11 years ago
Link
I've been beta-testing the desktop version of the Mailbox iPhone app for the last couple of days, and been pleasantly surprised.
Of course, I've already drunk the Inbox Zero Kool Aid - and if you haven't, Mailbox really isn't for you. If you have, however, it really is geared towards making it as simple and pain-free as possible to get There. The desktop version only extends upon that. For searching, you can't beat the Gmail website, but for quickly triaging and processing email, this surprisingly works better. Loving it!
0 notes
htwjw 11 years ago
Photo
Tumblr media
454K notes View notes
htwjw 11 years ago
Photo
Tumblr media
Rare photo of true samurai, circa 1866, Japan, 聽by photographer Felice Beato. A year or two after this photograph was taken, the samurai were abolished, and with it the Japanese feudal system.
7K notes View notes
htwjw 11 years ago
Link
Shim for WeakMap with non-leaky O(1) lookup time
1 note View note
htwjw 11 years ago
Link
... seems very cool - wish it were available聽serverside too - seems like a good Node alternative :-)
0 notes
htwjw 11 years ago
Text
Create a FreeDOS USB drive from a Mac
To create a USB bootable DOS drive from a Mac, download one of the images from聽http://chtaube.eu/computers/freedos/bootable-usb/
Follow the process at聽http://www.pyrosoft.co.uk/blog/2013/01/09/creating-a-bootable-usb-stick-from-osx/ to format with the USB drive with the right MBR settings.
Then, rather then using UNetbootin to install the image, use dd to install the image downloaded in the 1st step.
0 notes
htwjw 11 years ago
Text
Google Dev Hell
A few times a year I write code to interface with the Google APIs. And every time I wish I wouldn't have to. Not only do they manage to make the simple complicated, if only they could keep things the same. But nooo, they have to change everything. The API changes. The developer console changes (hopelessly...) The bloody names for things change (yeah, you know, it聽was a "browser key" you wanted, but that's now called a "public API access key"). And they don't update references, so it's up to you to figure this hell out. Or get the hell out...
1 note View note
htwjw 11 years ago
Link
Upped nerd cred: just created my first npm module (to debug missing callback calls)
0 notes
htwjw 11 years ago
Link
Refactors your CSS and generates a new stylesheet for your site.
Awesome!
0 notes
htwjw 11 years ago
Text
Node & Mongo & Longs
Using Mongo? Using Node? Using longs? Read on...
There are (at least) 2 ways to convert a string to a Mongo long: using the constructor (new mongo.Long) and using mongo.Long.fromString. Guess what - that's聽wrong - the constructor is聽not meant to convert strings to longs. It isn't. No. Not. It silently eats the highest bits, no complaints, no questions, so don't do it. Alright?
0 notes
htwjw 11 years ago
Link
So, a bit confused about the role of the Model in MVCs? Read this SO answer
0 notes
htwjw 11 years ago
Link
Attended my first hackathon yesterday organized by Copenhagen Node.js聽and kindly hosted by Shape. 聽An interesting experience - lots of friendly likeminded people getting together and hacking at their own or each other's projects while exchanging opinions & information.
I came to work on a combination of familiar and unfamiliar territories - a Node.js Express app that through Socket.io and React.js allowed users to dip their toes into the Twitter Search stream and shows new tweets as they come by. The end result is functional though by no means production ready - but it was an excellent study and I'm pleased to have gotten to a working version in 1 day. Those interested in the result can check out this聽TwitterStreamWatcher repo on Github.
React.js was a pleasure to work with - it has its weirdnesses (such as requiring an extra compile step) but the end result is flexible enough to quite quickly develop functional apps, without the library forcing you into directions you do not want to take. Check it out!
0 notes
htwjw 11 years ago
Link
Some love for a random snippet found out there: Moment.js handlebars helper. No rocket science, but simply useful! Thanks!
0 notes
htwjw 11 years ago
Link
Completely over the top awesomness!
It鈥檚 pretty damn cool.
4 notes View notes
htwjw 11 years ago
Text
On the horizon: generators, yield, promises
From the department of "Let's see what's in the JS pipeline", I decided to spend some time looking at ES6's generators, especially what it means from a Node.js perspective. Stuff like this is available since node v0.11.2; not production ready, but not that far off, either.
Now, while generators (with yield and stuff) are easy enough to understand, the combination of generators and promises is rather mind expanding... Alex Maccaw's "how yield will transform Node.js" and James Longster's "A Study on Solving Callbacks with JavaScript Generators" helped, here, to get a handle, but this is definitely material to meditate about...
Promises on their own are too esoteric, IMHO, to acquire mass adoption, and maybe so are generators. Together, however, they might just make a combination that is hard to ignore.
0 notes
htwjw 12 years ago
Text
Handlebars and partials
So, I discovered Handlebars partials can work not only as globals, but also be defined at template run time, like such:
var html = myTemplate({ firstname: 'John' }, {partials: {myPartial: Handlebars.compile('Hello {{firstname}}') } } );
But why is it so hard to find any documentation on this? And how can I get a list of all defined partials (not just the global ones) within a helper function?
0 notes