Skip to content

Instantly share code, notes, and snippets.

View tsvetomir's full-sized avatar

Tsvetomir Tsonev tsvetomir

View GitHub Profile
@tsvetomir
tsvetomir / gist:3817178
Created October 2, 2012 07:56
Comparing JS dates
var d1 = new Date(),
d2 = new Date(d1.getTime());
console.log("d1 === d2 ->", d1 === d2); // false
console.log("d1 == d2 ->", d1 == d2); // false
console.log("d1 < d2 ->", d1 < d2); // false
console.log("d1 > d2 ->", d1 > d2); // false
console.log("d1 <= d2 ->", d1 <= d2); // true
console.log("d1 >= d2 ->", d1 >= d2); // true
// George Bool is really pissed at this point
function Point(a, b) {
if (arguments.length === 1) {
this.x = Math.round(a / 1000);
this.y = a - this.x * 1000;
} else {
this.x = a;
this.y = b;
}
}
@tsvetomir
tsvetomir / campfire-localtime.js
Created March 15, 2012 15:59
Local time in Campfire chats
// ==UserScript==
// @name Campfire local time
// @namespace http://tsonev.net/campfire/localtime
// @version 0.2
// @description Converts time stamps to local time in Campfire chats. Tested in Chrome.
// @match https://XXXXXX.campfirenow.com/room/*
// ==/UserScript==
var TIME_ZONE = "CDT";