• Stars
    star
    125
  • Rank 286,335 (Top 6 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created almost 13 years ago
  • Updated about 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Port of Python calendar.py module to JavaScript

calendar.js

Functions inspired by the calendar module from the Python standard library.

The monthDates function builds an array of weeks to display one month, starting on Sunday (default) or Monday. Each week is an array of seven Date instances, including dates from the month before or after, as needed to fill the first and last weeks.

Optional formatting functions may be passed as third and fourth arguments: one to format each date, the other to format each week.

> cal = new c.Calendar();               // weeks start on Sunday by default
> m = cal.monthDates(2012,0,            // January is 0 in JS Date
...   function(d) {return (' '+d.getDate()).slice(-2)}, 
...   function(w) {return w.join(' | ')}
);
> for (i=0; i<m.length; i++) console.log(m[i]);
 1 |  2 |  3 |  4 |  5 |  6 |  7
 8 |  9 | 10 | 11 | 12 | 13 | 14
15 | 16 | 17 | 18 | 19 | 20 | 21
22 | 23 | 24 | 25 | 26 | 27 | 28
29 | 30 | 31 |  1 |  2 |  3 |  4

The monthDays function calls monthDates passing a simple function which returns the day number from a date, or zero if the date does not belong to the month.

> cal = new Calendar(1);               // weeks starting on Monday
> m = cal.monthDays(2012, 1);
> for (i=0; i<m.length; i++) console.log(m[i]);
[0, 0, 1, 2, 3, 4, 5]
[6, 7, 8, 9, 10, 11, 12]
[13, 14, 15, 16, 17, 18, 19]
[20, 21, 22, 23, 24, 25, 26]
[27, 28, 29, 0, 0, 0, 0]

More Repositories

1

pyob

Pythonic Objects
Jupyter Notebook
109
star
2

python-patterns-examples

A collection of Design Patters implemented in Python
Java
88
star
3

python-eng

Material para o curso Python Engineer da Linux Tips
Python
48
star
4

propython

Exemplos para aprender a linguagem Python
Python
46
star
5

uintset

A Python set type designed for dense sets of non-negative integers.
Python
31
star
6

aprendaprog

Aprenda a Programar
Jupyter Notebook
28
star
7

jupyturtle

Python Turtle graphics for Jupyter notebooks
Jupyter Notebook
26
star
8

go-pythonista

Go na visão de um Pythonista
Python
25
star
9

kaminpy

This repo is archived. Active work continued in fork github.com/pliba/kaminpy
PostScript
24
star
10

leanstr

A "lean" string class for Python, using UTF-8 internally
Python
23
star
11

strset

A full-featured set type for string elements in Go
Go
21
star
12

rf

Runefinder: locate Unicode characters by name. Simplest sensible implementations.
Jupyter Notebook
18
star
13

runefinder

A tool for finding Unicode characters by name. CLI and Web.
Go
16
star
14

tdd-com-pytest

Exemplos para praticar TDD com Pytest
Python
14
star
15

gentle-tdd-in-go

A Gentle Introduction of TDD in Go
Go
13
star
16

set-practice

Code and materials for the talk "Set practice: coding & using sets in Go"
Go
12
star
17

oficina-pyfluente

Oficina Python Fluente oferecida no Garoa Hacker Clube a partir de 30/jul/2024
Jupyter Notebook
11
star
18

palivres

Lista livre de palavras
Python
10
star
19

modernoopy

Modern Object Oriented Programming in Python
Python
10
star
20

chipy2019

Examples for a talk at ChiPy — June 26, 2019.
Python
10
star
21

drawtree

Draw tree diagrams from indented text input or Python class objects.
Python
10
star
22

py103

Introdução a Python para programadores craques
Python
9
star
23

cdc

Exemplos de códigos de conduta
9
star
24

pizza

Django: exemplo de sistema para pizzaria delivery
9
star
25

lc-with-redex

Lambda calculus with Scheme and PLT-Redex, by Jos Koot
Scheme
8
star
26

pymatching

Python Pattern Matching Examples
Python
8
star
27

oopython

Orientação a Objetos em Python: apresentação feita em Sphinx
Python
8
star
28

beyond-paradigms

Palestra: Cadê o paradigma? Teoria para entender Go na prática.
Go
7
star
29

mac316

Code from and inspired by Prof. Gubi's course about Programming Languages at IME/USP
Scheme
6
star
30

learnerl

Learning Erlang
Erlang
6
star
31

mongo-exem

Exemplos com MongoDB
Python
6
star
32

codigos-cifras

Códigos e cifras - criptografia para curiosos
Jupyter Notebook
6
star
33

platespinning

Concurrency examples
Python
6
star
34

runes2019

A new take on the runefinder example
Go
6
star
35

konk

The Konk programming language
6
star
36

tudo-agora

Exemplos para a palestra "Python Assíncrono: Tudo ao Mesmo Tempo Agora"
Python
6
star
37

learning-go

Makefile
5
star
38

albers-city

Remix da obra City de Josef Albers
Python
5
star
39

djangotemp

Repositório temporário para um curso de Django
Python
5
star
40

brainfuck

My implementation of Urban Müller's Brainfuck
Brainfuck
5
star
41

eagle-py

Eagle, a Python library to make GUI development easier
Python
5
star
42

beautiful-pattern

The Art of The Interpreter
Python
4
star
43

pyobject-lab

Exploring Python objects with ctypes
4
star
44

orablog

O'Reilly blog contribs
4
star
45

metaprog

Metaprogramação
JavaScript
4
star
46

academia-programador

Exemplos que usei na Academia do Programador na Globalcode
Java
4
star
47

CBofN

Source code from the book "The Computational Beauty of Nature"
C
4
star
48

fatec2017

Demonstração de TDD em 40 minutos
Python
4
star
49

djangopedia

Collaborative, modular and highly cross-referenced documentation for the Django framework
Python
4
star
50

cli-rust

Examples from (or inspired by) the book Command-line Rust
Rust
4
star
51

chardet

Mirror of Mark Pilgrim's character encoding detecion package
Python
4
star
52

py4sa

Code from the book Python for System Administrators, slightly reorganized
Python
4
star
53

musica

Experimentos com música
Jupyter Notebook
4
star
54

dojos

Coding Dojos
Python
4
star
55

govarmodels

Go variable models
Go
4
star
56

mongo-openlibrary

Scripts for loading and managing Open Library data sets in MongoDB
Python
4
star
57

slang

Mini-language interpreter derived from Peter Norvig's lis.py
Python
4
star
58

intropytw

Exemplo de introdução ao Python: turma 0 da ThoughtWorks São Paulo
Jupyter Notebook
4
star
59

farinha

Medindo a quantidade de farinha de trigo em uma caixa
Jupyter Notebook
3
star
60

concurrent

Exemples for studying concurrent programming
Java
3
star
61

dialogue

The Dialogue class for testing REPLs, with examples
Python
3
star
62

plox

Nystrom's Lox language in Python
Python
3
star
63

claudia

A little cloud: portable lab for distributed systems experiments
Python
3
star
64

comprando-cama

Adaptação da cena "Buying a Bed" do Monty Python
3
star
65

gimel

Third variation of the Unicode finder utility in Elixir.
Elixir
3
star
66

lbs-examples

Examples and exercises from Allen Downey's Little Book of Semaphores
Go
3
star
67

mojifinder

Yet another Unicode character finder example
Jupyter Notebook
3
star
68

lispyse24

Tutorial lis.py atualizado para Python Sudeste 2024
Jupyter Notebook
2
star
69

spinners

Examples for Allen Downey's Little Book of Semaphores
Python
2
star
70

regroup

Simple script to create mixed groups or pairs from given groups.
Jupyter Notebook
2
star
71

tcc

Trabalho de Conclusão de Curso
2
star
72

prandiano

Experimentos durante o Curso Prandiano
Jupyter Notebook
2
star
73

tdd

Examples from Kent Beck's TDD book
Python
2
star
74

modulo3

Módulo 3 da Academia Python
Python
2
star
75

diapositivo

Esquema para fazer slides (ou diapositivos) usando HTML5
2
star
76

isbn

ISBN-10, ISBN-13 and EAN barcode validation library
Python
2
star
77

processando

Exemplos com processing.org
JavaScript
2
star
78

ardprjbk

Arduino Projects Book
Python
2
star
79

objpy-2016

Objetos Pythônicos 2016 -- palestra e tutorial
Python
2
star
80

atelier-labs

Exemplos da Oficina de Arte e Programação, com Etienne Delacroix (Poli/USP, PSI-2615, 2006)
Tcl
2
star
81

pysecret

Python: a arma secreta do Google
JavaScript
2
star
82

alambique

🝪 Experimentos com Elixir ⚗
Elixir
2
star
83

corrupiao

Jupyter Notebook
2
star
84

python-para-desenvolvedores

Exemplos do livro Python para Desenvolvedores de Luiz Eduardo Borges (Novatec, 2014)
Python
1
star
85

algomassa

Aprendendo algoritmos com massinha
Python
1
star
86

runeset

A set type for Unicode characters
Go
1
star
87

mongol

OpenLibrary in MongoDB
Python
1
star
88

wiki-standupdev

dokuwiki pages from standupdev.com/wiki
1
star
89

isarch

CDS/ISIS mailing list archive conversion and preservation scripts
Python
1
star
90

codder

Codd Relational Exerciser
Python
1
star
91

titans-group

Exemplos dos cursos de Python para Titans Group
Python
1
star
92

naadam

A MongoDB festival
Python
1
star
93

magnet-redux

Exemplo de Django com Twitter Bootstrap usando conteúdo da agência de notícias Magnet
JavaScript
1
star
94

islands_engine

Example from "Functional Web Development with Elixir, OTP, and Phoenix", by Lance Halvorsen
Elixir
1
star
95

framboesa

Experimentos com Raspberry Pi
Python
1
star
96

isis2json

CDS/ISIS to JSON database converter (compatible with CouchDB and MongoDB)
1
star
97

iching

Experiments with the Yi Jing, the Book of Changes, a.k.a. I Ching
HTML
1
star
98

elnad

Django demo app based on examples from the Elmasri & Navathe DB Systems book
1
star
99

mongosp

scripts para a palestra "Open Library em MongoDB" apresentada no MongoDB São Paulo, jul/2012
JavaScript
1
star
100

eventex

Python
1
star