Skip to content

Instantly share code, notes, and snippets.

View LinuxDoku's full-sized avatar

Martin Lantzsch LinuxDoku

View GitHub Profile
@g0t4
g0t4 / hackNancyRazorPageBaseType
Last active August 29, 2015 13:55
Hack to set a custom base view with Nancy and Razor
// At this time Nancy's Razor view engine doesn't let you set a default base class like ASP.NET web pages does with pageBaseType, if you want to hack one in here is how:
// First create your custom type, this one writes out hack for everything, so obviously remove that unless you want that :)
public abstract class MyRazorPage<T> : NancyRazorViewBase<T>
{
public override void Write(object value)
{
base.WriteLiteral("hack");
}
@kTmnh
kTmnh / ios6-timers.js
Last active April 27, 2022 21:24 — forked from ronkorving/ios6-timers.js
iOS6 webkit timer bug workaround
(function (window) {
// This library re-implements setTimeout, setInterval, clearTimeout, clearInterval for iOS6.
// iOS6 suffers from a bug that kills timers that are created while a page is scrolling.
// This library fixes that problem by recreating timers after scrolling finishes (with interval correction).
// This code is free to use by anyone (MIT, blabla).
// Original Author: rkorving@wizcorp.jp
var timeouts = {};
var intervals = {};
var orgSetTimeout = window.setTimeout;
var orgSetInterval = window.setInterval;
--- a/server/modules/http-plugin/web/js/cloud-carousel.1.0.5.js
+++ b/server/modules/http-plugin/web/js/cloud-carousel.1.0.5.js
@@ -209,6 +207,9 @@
this.rotate = function(direction)
{
this.frontIndex -= direction;
+ if (this.frontIndex < 0) {
+ this.frontIndex = items.length - 1;
+ }
this.frontIndex %= items.length;
@LinuxDoku
LinuxDoku / jamedo.php
Created August 29, 2011 20:27
Download Jamedo Songs
<?php
if(isset($_GET['id'])) {
$trackID = (int)$_GET['id'];
// get download url
$trackUrl = file_get_contents('http://www.jamendo.com/get/track/id/track/audio/plain/'.$trackID.'/?aue=ogg2');
if($trackUrl == false) {
echo 'track id not availible!';
} else {
// get track information
$trackTitle = (string)file_get_contents('http://www.jamendo.com/get/album/id/album/title/plain/'.$trackID.'/');