NOTE: This is a question I found on StackOverflow which I’ve archived here, because the answer is so effing phenomenal.
If you are not into long explanations, see [Paolo Bergantino’s answer][2].
// | |
// Regular Expression for URL validation | |
// | |
// Author: Diego Perini | |
// Created: 2010/12/05 | |
// Updated: 2018/09/12 | |
// License: MIT | |
// | |
// Copyright (c) 2010-2018 Diego Perini (http://www.iport.it) | |
// |
# Example usage: | |
# with temporary_settings(CELERY_ALWAYS_EAGER=True): | |
# run_task.delay() # runs task with eager setting enabled. | |
from contextlib import contextmanager | |
from django.conf import settings | |
@contextmanager | |
def temporary_settings(**temp_settings): | |
orig_settings = {} |
package main | |
import ( | |
"bytes" | |
"encoding/hex" | |
"flag" | |
"fmt" | |
"io" | |
"log" | |
"net" |
#!/usr/bin/env ruby | |
=begin | |
= Geographic Searches With Postgres's Earthdistance and Cube Extensions | |
This program shows how to easily create a Postgres database that uses the Cube | |
and Earthdistance extensions to perform fast queries on geographic data. | |
Briefly, the problem this code solves is "show me all places within 50 | |
kilometers of New York City." |
NOTE: This is a question I found on StackOverflow which I’ve archived here, because the answer is so effing phenomenal.
If you are not into long explanations, see [Paolo Bergantino’s answer][2].
#!/bin/bash | |
##################################################### | |
# Name: Bash CheatSheet for Mac OSX | |
# | |
# A little overlook of the Bash basics | |
# | |
# Usage: | |
# | |
# Author: J. Le Coupanec | |
# Date: 2014/11/04 |
# Hello, and welcome to makefile basics. | |
# | |
# You will learn why `make` is so great, and why, despite its "weird" syntax, | |
# it is actually a highly expressive, efficient, and powerful way to build | |
# programs. | |
# | |
# Once you're done here, go to | |
# http://www.gnu.org/software/make/manual/make.html | |
# to learn SOOOO much more. |
class Hst | |
attr_reader :version | |
attr_reader :copyright | |
attr_reader :symbol | |
attr_reader :period | |
attr_reader :digits | |
attr_reader :timesign | |
attr_reader :lastsync | |
def initialize(file) |
# Example makefile with some dummy rules | |
.PHONY: all | |
## Make ALL the things; this includes: building the target, testing it, and | |
## deploying to server. | |
all: test deploy | |
.PHONY: build | |
# No documentation; target will be omitted from help display | |
build: |
This is a compiled list of falsehoods programmers tend to believe about working with time.
Don't re-invent a date time library yourself. If you think you understand everything about time, you're probably doing it wrong.