• Stars
    star
    202
  • Rank 193,044 (Top 4 %)
  • Language
  • License
    MIT License
  • Created almost 11 years ago
  • Updated about 1 year ago

Reviews

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

Repository Details

:trollface: Year as a Service

YaaS

Year as a Service. Provides the current year as a service.

Examples

Note that these examples may not take into account good security practices, for example escaping output to prevent XSS vulnerabilities.

PHP

<?php
$year = file_get_contents('https://raw.github.com/asgrim/year/master/en/currentYear');

echo $year; // 2020

Ruby

require 'net/http'
year = Net::HTTP.get_response(URI.parse("https://raw.github.com/asgrim/year/master/en/currentYear")).body
p year # 2020

Python

import urllib2
year = urllib2.urlopen('https://raw.github.com/asgrim/year/master/en/currentYear').read(1000).strip()
print year; # 2020

JavaScript

// Fetch
fetch('https://raw.githubusercontent.com/asgrim/year/master/en/currentYear')
    .then(resp => resp.json())
    .then(year => console.log(year)) // 2020

// XMLHttpRequest
let xhr = new XMLHttpRequest()
xhr.open('GET', 'https://raw.githubusercontent.com/asgrim/year/master/en/currentYear', true);
xhr.onload = () => {
    if (xhr.status >= 200 && xhr.status < 300 || xhr.status === 304) {
        console.log(xhr.responseText)
    }
};
xhr.send(); // 2020

Bash

#!/bin/bash
## Fetch
page="$(curl -s https://raw.githubusercontent.com/asgrim/year/master/en/currentYear)"
echo "$page" # 2020

BC Break

In the future, we may have to break BC by removing the root "currentYear". You should use "en/currentYear" instead.

Internationalisation (i18n)

YaaS also supports the following calendars:

Hebrew (he):

Chinese (zh-cn):

FAQs

Should I use this in my real application?

  • No.

r u troleing me?

  • Yes.

More Repositories

1

ofxparser

πŸ’° OFX File Parser
PHP
108
star
2

yamldb

Don't use this, please.
PHP
35
star
3

quality-tutorial

Sample code and exercises for my quality PHP workshop
PHP
30
star
4

book-library

Demo application using Expressive that I use in talks
PHP
25
star
5

mini-mezzio

Minimal Application Factory for Mezzio
PHP
20
star
6

rust-ffi-test

Using a Rust lib in a PHP FFI test
Rust
18
star
7

side-effect

Side Effect Framework
PHP
16
star
8

godeploy

⚠️ Abandoned ⚠️
PHP
15
star
9

code-review-checklist

11
star
10

rmq-slides

Code and examples to go with my RabbitMQ presentation
PHP
10
star
11

basic-maths-compiler

Basic maths compiler for my AST talk
PHP
9
star
12

rmq-tutorial

Tutorial resources
PHP
7
star
13

random-status-middleware

Randomise the status code returned from a middleware pipeline.
PHP
6
star
14

directory-syncing-thing

A simple script that uses inotify to "sync" files quickly when they change from one directory to another
Shell
5
star
15

class-api-dumper

Small tool to dump a summary of a class's API
PHP
4
star
16

example-pie-extension

An example of a PIE-enabled PHP module
C
4
star
17

es-book-library

A book library demo using Eventsauce.io
PHP
3
star
18

joindin-random-feedback-selector

A little tool that selects random feedback from an event on Joind.in
PHP
3
star
19

zdt-memcache

Zend Developer Tools Memcache plugin
PHP
3
star
20

jamestitcumb

My personal website
PHP
2
star
21

darklord

Information and whatnot for Darklord MUD
HTML
2
star
22

mal

Mighty Asgrim's Library. Just a collection of lib classes for Zend Framework I've made that sort of make my life easier. Some of them may actually overlap ZF built-in functionality, but these are mainly just me messing around!
PHP
2
star
23

ha-php

PHP agent running my Pi that talks to Home Assistant
PHP
1
star
24

apoc

MUD
C
1
star
25

random-php-generator

cuz, why not
PHP
1
star
26

script-running-indicator

Just an Ubuntu indicator app to run a script
Python
1
star
27

scout-test-project

Testing out Scout APM
PHP
1
star
28

uuid2clip

A simple tool that generates a UUIDv4 and puts it in the clipboard
Rust
1
star
29

meet.asgrim.com

HTML
1
star
30

cleverbotselfchat

Just mucking around with Selenium
Java
1
star
31

zend-cache-example

Isolated Zend\Cache example
PHP
1
star
32

zfhtml5

Zend Framework HTML5 base project
JavaScript
1
star
33

phpstan-zend-framework

PHPStan extension for Zend Framework and Expressive
PHP
1
star
34

arson

Asgrim's Rust-based JSON viewer tool.
Rust
1
star