Skip to content

Instantly share code, notes, and snippets.

View b2rsp's full-sized avatar

Vitor Gonçalves b2rsp

View GitHub Profile
@b2rsp
b2rsp / moment.workdays.js
Created September 8, 2017 12:02 — forked from ioleo/moment.workdays.js
introduce 'workdays' mode to moment.js add/subtract methods (PL national holidays)
(function (undefined) {
/**
* moment.easter
* Source: https://github.com/zaygraveyard/moment-easter
* License: MIT
*/
moment.easter = function Easter20ops(year) {
var a = (year / 100 | 0) * 1483 - (year / 400 | 0) * 2225 + 2613;
var b = ((year % 19 * 3510 + (a / 25 | 0) * 319) / 330 | 0) % 29;
var c = 148 - b - ((year * 5 / 4 | 0) + a - b) % 7;
@b2rsp
b2rsp / better-nodejs-require-paths.md
Created November 2, 2016 17:39 — forked from branneman/better-nodejs-require-paths.md
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

var Article = require('../../../models/article');

Those suck for maintenance and they're ugly.

Possible solutions

@b2rsp
b2rsp / introrx.md
Created April 27, 2016 17:08 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
<snippet>
<content><![CDATA[
<!doctype html>
<!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ -->
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
<meta charset="utf-8">
(function () {
var myPrototype = {
methodA: function methodA() {},
methodB: function methodB() {},
methodC: function methodC() {}
};
window.createFoo = function createFoo() {
return (Object.create(myPrototype));
};