Profile

Scrapbook photo 1
Scrapbook photo 2
Sam Neubardt
Works at Twitter
Attended City College of New York
151 followers|4,388 views
AboutPostsPhotosVideosReviews

Stream

Sam Neubardt

Shared publicly  - 
 
Been playing around with core.logic and it is so much fun
Pro tip by Sam Neubardt about core.logic and macros. Coderwall is a space for tech's most talented makers to connect, share, build, and be inspired
1
Add a comment...

Sam Neubardt

Shared publicly  - 
 
my new blog
1
Add a comment...

Sam Neubardt

Shared publicly  - 
 
Entropy (2010). Entropy is a programming langauge where data decays as the program runs. Each value will alter slightly every time it's used, becoming less precise. An Entropy programmer needs to ...
1
dan garfield's profile photo
 
lolwut. funny toy.
Add a comment...

Sam Neubardt

Shared publicly  - 
 
perfect night for snow biking :D
1
Add a comment...

Sam Neubardt

Shared publicly  - 
 
Spicy sweet potato fries! 
4
dan garfield's profile photoSam Neubardt's profile photo
2 comments
 
yeah! yucca is da bomb
Add a comment...
Have him in circles
151 people
Aron Atkins's profile photo
Terran Vigil's profile photo
Eleido Rodriguez Matias's profile photo
Tony Lenox's profile photo
Becky Bajan's profile photo
Miguel Alvarado's profile photo
Ow en's profile photo
Sarah Wolf's profile photo
Carl Chinatomby's profile photo

Sam Neubardt

Shared publicly  - 
 
My problem with these types of arguments is that the proponents want to argue on a group level with some things, but not others. Apparently, all white males are doing something bad by not sharing enou...
1
Add a comment...

Sam Neubardt

Shared publicly  - 
 
so good, smash patriarchy!

via +Samantha Lifson
1
Add a comment...

Sam Neubardt

Shared publicly  - 
 
You know that wonderfully, wryly apt Gibson line: "The future is here, it's just not evenly distributed"? I came across this article a few days ago, detailing several self-cleaning fabri...
1
3
Eric Leventhal Arthen's profile photoKee Hinckley's profile photoDaniel Rinehart's profile photo
 
Very good article. Does make me thing about these issues from a different angle.
<<In the "male" sphere, of professional operations, offices, corporations, pop culture, businesses, the available technology was extremely high-level, better than anywhere I'd yet lived. In the "female" sphere, the home, domestic duties, daily chores, cleaning, heating, anything inside the walls of a house, it was on a level my grandmother would find familiar.>>
Add a comment...

Sam Neubardt

Shared publicly  - 
 
Spent a couple of hours tracking down a weird bug with dates in JS, so please allow me to decant some knowledge that resulted from this afternoon's toils.

Some Background
Entities in the application have a datetime field and are persisted in the GAE data store. The data store treats all dates/times as being in UTC (as it should, since timezones are part of the presentation layer). I'd already validated that the datetimes of entities in the data store were correctly stored as UTC.

A date is passed into the application's javascript when the containing page is rendered. It was passed as a date string, e.g. new Date("8/5/11 14:22")
A loop would increment the date by constructing a new date like this:
var nextDay = new Date(startDate.getTime() + 86400000);
Calling startDate.setDate(startDate.getDate() + 1) doesn't work because it won't increment through to the month or year (e.g. increment 12/31 won't result in 1/1). Adding to the unix time representation of the date will.

The Problem
The application is supposed to display dates as UTC but some were displaying as UTC + 5 (i'm in EST). The UTC time would be accessed through the getUTC* methods on a date object.

The Solution
There's a subtlety with the Date constructor (subtle as in i didn't realize it and didn't see it explicitly documented anywhere). Unix timestamps are in GMT and the Date constructor treats them as such. However, date string's without a timezone are treated as in the browser's timezone.

Some examples:
new Date("8/5/11 12:11").getHours() // => 12
new Date("8/5/11 12:11").getUTCHours() // => 17

// 1312586961 == Fri, 05 Aug 2011 23:29:21 GMT
new Date(1312586961000).getHours() // => 19
new Date(1312586961000).getUTCHours() // => 23

Setting a Date using a unix timestamp will always assume that the timestamp is in UTC. Setting a date using a datestring will assume it's in the user's local time zone if not otherwise specified.

The bug was caused by constructing a Date with a datestring that represented a time in UTC without a timezone in the string. The time was interpreted to be in EST (so getHours was in UTC and getUTCHours was in UTC + 5).

var today = new Date("8/5/11 12:11") // in UTC
var tomorrow = new Date(today.getTime() + 86400000)
Since it's expected that getTime will return a timestamp in UTC and that today was constructed with a local time it converts that UTC time to UTC again (shifting it forward 5 hours). So tomorrow is actually 1 day & 5 hours ahead.
1
dan garfield's profile photo
 
not a bug. working as intended. the new modified brobdingnabian calendar went into effect last week and we are now on 29 hour days.
Add a comment...

Sam Neubardt

Shared publicly  - 
 
checkout my blog discussing the science of trucks & their (currently unknown) origins with plenty of juicy pics
Truckspotting. No one really knows where trucks come from... RSS; /; Archive. Jul 8. Sighted this green beauty just truckin&#8217; along. Sighted this green beauty just truckin' along on the s...
5
Jeremy Neiman's profile photodan garfield's profile photoSam Neubardt's profile photo
3 comments
 
Thank you for your continued support. There's a lot of exciting research in the field of truck science forthcoming.
Add a comment...
People
Have him in circles
151 people
Aron Atkins's profile photo
Terran Vigil's profile photo
Eleido Rodriguez Matias's profile photo
Tony Lenox's profile photo
Becky Bajan's profile photo
Miguel Alvarado's profile photo
Ow en's profile photo
Sarah Wolf's profile photo
Carl Chinatomby's profile photo
Education
  • City College of New York
    Computer Science, 2007 - 2011
Work
Occupation
computer programmer
Employment
  • Twitter
    Engineer, 2013 - present
  • Crashlytics
    Engineer, 2012 - 2013
  • Brightcove
    Software Engineer, 2008 - 2012
Basic Information
Gender
Male
Wonderful rooms in a beautifully preserved and decorated Victorian mansion steps away from Newport's many attractions. Nick & Brian were great hosts who provided great breakfast and recommendations. Our stay was perfect and we can't wait to go back!
Public - a year ago
reviewed a year ago
1 review
Map
Map
Map