Skip to content

Instantly share code, notes, and snippets.

View axelpale's full-sized avatar

Akseli Palén axelpale

View GitHub Profile
@axelpale
axelpale / geostamp.js
Created November 11, 2016 17:03
A HTML markup module for GeoJSON points
// A HTML markup module for GeoJSON points. In addition to well formatted
// coordinate output, it creates a Wikipedia-favoured link to
// tools.wmflabs.org/geohack
//
// Usage example:
// var p = { type: 'Point', coordinates: [-118.25013445, 34.05394492] }
// var html = geostamp(p);
//
// Looks like:
// 34.053944° N, 118.250134° E
@axelpale
axelpale / ghoulog.js
Created April 17, 2016 20:18
Mirror console logs into a small div at top-left corner, styled in post-apocalyptic way
// Mirror console logs into a small div at top-left corner,
// styled in post-apocalyptic way ;)
//
// Usage is simple, just:
// <script src='ghoulog.js'></script>
//
// Note:
// You must set body { position: relative; } to let log div to be
// absolutely positioned.
//
@axelpale
axelpale / frange.py
Last active April 19, 2021 09:08
Python range function for floats
'''
Copyright 2016 Akseli Palén.
Created 2016-04-02.
Licensed under the MIT license.
<license>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files
(the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge,
@axelpale
axelpale / findzeros.py
Created August 29, 2013 10:04
Python script to list files of zero size. Takes in a filepath of a textfile containing a list of filepaths and looks if the list contains files with filesize of zero. The filepaths of files with zero size are stored to file named the original filepath of the list prefixed _zeros
"""
List files of zero size.
Takes in a filepath of a textfile containing a list of filepaths
and looks if the list contains files with filesize of zero.
The filepaths of files with zero size are stored to file named
the original filepath of the list prefixed _zeros
Example Usage
@axelpale
axelpale / django-crossdomainxhr-middleware.py
Created August 5, 2012 10:01 — forked from vicalejuri/django-crossdomainxhr-middleware.py
Middlware to allow's your django server to respond appropriately to cross domain XHR (postMessage html5 API).
# -*- coding: utf-8 -*-
# Source:
# https://gist.github.com/3263576
import re
from django.utils.text import compress_string
from django.utils.cache import patch_vary_headers
from django import http
import settings
@axelpale
axelpale / combinations.js
Last active July 7, 2023 10:37
JavaScript functions to calculate combinations of elements in Array.
/**
* Copyright 2012 Akseli Palén.
* Created 2012-07-15.
* Licensed under the MIT license.
*
* <license>
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files
* (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge,