Skip to content

Instantly share code, notes, and snippets.

View pavel-lens's full-sized avatar

pavel-lens pavel-lens

  • Ether
View GitHub Profile
@weslleih
weslleih / date.extensions.ts
Last active November 11, 2023 08:00
Extend the TypeScript Date Object with some useful methods
export {}
declare global {
interface Date {
addDays(days: number, useThis?: boolean): Date;
isToday(): boolean;
clone(): Date;
isAnotherMonth(date: Date): boolean;
isWeekend(): boolean;
isSameDate(date: Date): boolean;
@branneman
branneman / better-nodejs-require-paths.md
Last active June 29, 2024 16:00
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:

const Article = require('../../../../app/models/article');

Those suck for maintenance and they're ugly.

Possible solutions

@StatusReport
StatusReport / waze.py
Created December 7, 2013 16:46
Simple Waze wrapper for querying route cross time with / without real time data. More work is required with parsing the JSON returned from the server to extract the textual route information, but it should be pretty straightforward.
import json
import urllib
class WazeLocationNotFoundException(Exception):
pass
class Waze(object):
_BASE_URL = "http://www.waze.co.il/"
def __mozi(self, query):