Skip to content

Instantly share code, notes, and snippets.

View mihaipaun's full-sized avatar

Mihai Păun mihaipaun

  • Bank of America Merrill Lynch
  • Dublin, Ireland
View GitHub Profile
@mihaipaun
mihaipaun / about.md
Created August 10, 2011 07:38 — forked from jasonrudolph/about.md
Programming Achievements: How to Level Up as a Developer
@mihaipaun
mihaipaun / gist:2318942
Created April 6, 2012 11:16
JavaScript: PubSub model for jQuery
/* 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 April 6, 2012 10:45
HTML starting template
<!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 / ConvertDateTimeFromESTToUsersTimezone.js
Last active August 20, 2021 07:46
JavaScript: Convert from EST to user's local time zone
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