Stories
Slash Boxes
Comments

SoylentNews is people

Log In

Log In

Create Account  |  Retrieve Password


Day five

Posted by Blackmoore on Wednesday February 19 2014, @03:54AM (#43)
0 Comments
/dev/random

Day 5, the sky has broken open and begun to rain upon the vessel. So far we have sent the cabin boy down to pump the bilge.

tzdata-javascript - A JS library for working with timezones

Posted by stderr on Tuesday February 18 2014, @08:44PM (#40)
0 Comments
Code

For some time I have been working on a JavaScript library for working with timezones. The name is tzdata-javascript

To use it, you would first load the library like this:

<script type="text/javascript" src="http://tzdata-javascript.org/tzdata-javascript.js">
</script>

(SoylentNews seems to break the URL for the .js file in a weird place, but I'm sure you can figure out what it should be...)

And then use it like this:

<script type="text/javascript">
    # Load the timezone you want to use:
    var la=new tzdata_javascript.zoneinfo("America/Los_Angeles");
    var cph=new tzdata_javascript.zoneinfo("Europe/Copenhagen");
    var hk=new tzdata_javascript.zoneinfo("Asia/Hong_Kong");

    # Find the timestamp (in ms since Epoch) you want to convert to localtime:
    var now=new Date().valueOf();

    # Call the strftime() function of each of the timezones, you loaded earlier:
    alert(
        "The time in Los Angeles is : "+la.strftime("%+",now)+"\n"+

        "The time in Copenhagen is : "+cph.strftime("%+",now)+"\n"+

        "The time in Hong Kong is : "+hk.strftime("%+",now)+"\n"
    );
</script>

And that's about it... :-)

The librarys website has some more demos and examples.

My SoylentNews submissions

Posted by stderr on Tuesday February 18 2014, @08:18PM (#39)
0 Comments

Day three

Posted by Blackmoore on Tuesday February 18 2014, @12:22AM (#33)
0 Comments
Code

Crew managed to trade Spam for rum before we left port;

First mate was shanked for whistling showtunes on deck.

Day four

Posted by Blackmoore on Tuesday February 18 2014, @12:19AM (#32)
0 Comments
Code

Dear god, both day two and day three have been devoured by sharks.

Need more grog.

Learning

Posted by nobbis on Monday February 17 2014, @05:47PM (#30)
1 Comment
Career & Education

Lurking in the IRC channels for SN this week has been a fantastic experience.
Being exposed to experts ( and idiots ) with arcane bits of knowledge, not to mention the bread recipes has certainly added to my knowledge.
The best conclusion I have drawn though is that a skilled and dedicated team can achieve the near impossible, if they don't mind doing without sleep; I'm impressed.

Behold my journal entry! ;) It's so wonderful!

Posted by sea on Monday February 17 2014, @12:41AM (#23)
1 Comment
Science

First post, first post, ;)

A - Here is a humble letter A.

B - There is B.

C - This one is a little odd, but nice overall.

D - STAY THE FUCK AWAY FROM THIS ONE.

Slashcott officially extended to a second week

Posted by unitron on Sunday February 16 2014, @02:28AM (#19)
5 Comments
News
As long as I need to write stuff to test the features around here I thought I'd mention that the second week of Slashcott, so you guys get a little more breathing room and Dice gets a better visit from the Ghost of Slashcott future, will run from February 17th, 2014, to February 23rd, 2014.

Don't be there, aloha.

The lameness filter is lame

Posted by ragequit on Saturday February 15 2014, @04:57PM (#11)
0 Comments
Code
Refactoring is needed, but in its own way, it is kind of elegant. I'll have to look at zlib as a compression algorithm and see what the compressionOk() function is actually trying to do.

Journal Entry one

Posted by Blackmoore on Saturday February 15 2014, @03:17PM (#10)
0 Comments
Soylent
Day one,
The ship is stocked to the brim with spam and bottled water.
The crew has begun to mutiny.