Skip to content

Instantly share code, notes, and snippets.

Avatar

Mihai Păun mihaipaun

  • Bank of America Merrill Lynch
  • Dublin, Ireland
View GitHub Profile
@mihaipaun
mihaipaun / ConvertDateTimeFromESTToUsersTimezone.js
Last active Mar 28, 2020
JavaScript: Convert from EST to user's local time zone
View ConvertDateTimeFromESTToUsersTimezone.js
var serverDate = '2014-02-24 04:52:48.050000'; // EST
function convertServerDateToLocal(dateInput) {
// EST - UTC offset: 5 hours
var offset = 5.0,
/*
- calculate the difference between the server date and UTC
- the value returned by the getTime method is the number of milliseconds since 1 January 1970 00:00:00 UTC.
- the time-zone offset is the difference, in minutes, between UTC and local time
@mihaipaun
mihaipaun / gist:2318942
Created Apr 6, 2012
JavaScript: PubSub model for jQuery
View gist:2318942
/* Inspired from http://tutsplus.com/lesson/custom-events-and-the-observer-pattern/ */
(function( $ ) {
var o = $( {} );
$.each({
trigger: 'publish',
on: 'subscribe',
off: 'unsubscribe'
@mihaipaun
mihaipaun / gist:2318811
Created Apr 6, 2012
HTML starting template
View gist:2318811
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<title></title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"></script>
@mihaipaun
mihaipaun / about.md
Created Aug 10, 2011 — forked from jasonrudolph/about.md
Programming Achievements: How to Level Up as a Developer
View about.md
You can’t perform that action at this time.