Skip to content

Instantly share code, notes, and snippets.

View runepiper's full-sized avatar

Rune Piper runepiper

View GitHub Profile
@michamilz
michamilz / readme.md
Last active August 29, 2021 18:59
Userscript zum Lesen von SVZ+, Prignitzer+ und NNN+ Artikeln
<?php
public function findByPlaceAndRadius(Place $place, $radius, $limit = 15) {
$latitude = $place->getLatitude();
$longitude = $place->getLongitude();
$angleRadius = $radius / 111;
$min_lat = $latitude - $angleRadius;
$max_lat = $latitude + $angleRadius;
$min_lon = $longitude - $angleRadius;
$max_lon = $longitude + $angleRadius;
@jamesktan
jamesktan / Shell Commands ePub
Last active November 25, 2025 07:11
Unzipping & Zipping ePub from Command Line
// To unzip the epub, move the ePub to a folder, cd to it then simply:
unzip MyEbook.epub
// To zip up an epub:
1. zip -X MyNewEbook.epub mimetype
2. zip -rg MyNewEbook.epub META-INF -x \*.DS_Store
3. zip -rg MyNewEbook.epub OEBPS -x \*.DS_Store
Some explanations necessary here. We start each line with two flags:
@daftspunk
daftspunk / ConvertTwoSpacesToFour.sublime-macro
Created October 30, 2014 00:00
Convert 2 spaces to 4 spaces, Sublime Text macro
//
// Converts code indentation from 2 spaces to 4 spaces
//
// For a hotkey, add to Preferences > Key Bindings - User:
//
// { "keys": ["ctrl+alt+i"], "command": "run_macro_file", "args": {"file": "res://Packages/User/ConvertTwoSpacesToFour.sublime-macro"} }
//
[
@dave1010
dave1010 / php-regex-router.php
Created September 13, 2011 15:46
php-regex-router.php
<?php
// dangerously simple PHP regular expression URL router
// requires a mod_rewrite like "RewriteRule . /index.php [L]"
function get($url, $callback) {
$matches = array();
if (preg_match('~' . $url . '~', $_SERVER['REQUEST_URI'], $matches)) {
echo call_user_func_array($callback, $matches);
die();
}