Skip to content

Instantly share code, notes, and snippets.

Avatar

Akseli Palén axelpale

View GitHub Profile
@axelpale
axelpale / geostamp.js
Created Nov 11, 2016
A HTML markup module for GeoJSON points
View geostamp.js
// 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 Apr 17, 2016
Mirror console logs into a small div at top-left corner, styled in post-apocalyptic way
View ghoulog.js
// 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 Jul 14, 2018
Python range function for floats
View frange.py
'''
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 Aug 29, 2013
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
View findzeros.py
"""
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 Aug 5, 2012 — forked from barrabinfc/django-crossdomainxhr-middleware.py
Middlware to allow's your django server to respond appropriately to cross domain XHR (postMessage html5 API).
View django-crossdomainxhr-middleware.py
# -*- 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 Oct 4, 2020
JavaScript functions to calculate combinations of elements in Array.
View combinations.js
/**
* 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,
You can’t perform that action at this time.