Skip to content

Instantly share code, notes, and snippets.

View nicoknoll's full-sized avatar
💯
Getting things done.

Nico Knoll nicoknoll

💯
Getting things done.
View GitHub Profile
<?php
function getTracks() {
$data = json_decode(file_get_contents('http://ws.audioscrobbler.com/2.0/?method=user.getrecenttracks&user=derstadtpirat&api_key=LASTFMAPIKEY&format=json&limit=70&nowplaying=true'), true);
$tracks = array();
foreach($data['recenttracks']['track'] as $track) {
if($track['image'][0]['#text'] != '') {
$tracks[] = array(
'name' => trim($track['name']),
'album' => trim($track['album']['#text']),
<?php
function replaceSrc($matches) {
global $page;
$url = $matches[1];
$img = 'images/'.basename($url);
$handle = fopen($img, 'w+');
$data = file_get_contents($url);
@nicoknoll
nicoknoll / gist:10661190
Created April 14, 2014 16:02
Wordpress vs. Processwire
<?php
the_title();
?>
<?php
foreach($page->parents()->append($page)->slice(1)->reverse() as $parent) { echo ucfirst($parent->get('headline|title')).' - '; } echo 'Page Title';
@nicoknoll
nicoknoll / Guide.md
Last active August 29, 2015 14:04
Troubleshooting Processwire

File related problems

This guide will help you to solve the most common problems related to files.

File permissions

First of all (even if you don't have any problems at the moment) you should make sure that your current file permissions are right set:

/site/assets/ 755 (recursively)
...
<?php
if($_GET['ende']) {
$end = (int)$_GET['ende'];
setcookie('wochenendende', $end, 9999999999, '/');
} else {
$end = (($_COOKIE['wochenendende']) ? (int)$_COOKIE['wochenendende'] : 17);
}
// Die Ausgabe
echo $end;
?>

###HiDrive (Strato): 5TB kosten für die ersten 12 Monate 75€/Monat, danach 149€/Monat (bei 36 Monate Vertragslaufzeit). Vorteil ist auf jeden Fall, dass die Server in Deutschland stehen (Deutsche Datenschutzgesetze, kleine Entfernung = schnellerer Up-/Download) Anderer Vorteil: Funktioniert einwandfrei mit Synology

###CrashPlan Unlimitierte Anzahl an TB kosten zwischen 6$ und 12$ pro Monat. Nachteil: Server in den USA und Einrichtung mit Synology ist möglich, aber deutlich komplizierter als HiDrive

###Amazon Glacier

#include <math.h>
#include "oh_tannenbaum.h"
/* This melody is defined in the header above. */
int const melody[] = MELODY;
/********************************************************/
/* 3.) Define a constant LOUDSPEAKER_PIN containing the
number of the digital pin you just connected the
"+" pin of your loudspeaker to.
@nicoknoll
nicoknoll / i.md
Created January 28, 2015 19:26
Convert pdf to ppt on mac an linux

In case you want to convert your PT readings from PPT(X) to PDF it's really easy:

  1. Download libreoffice: https://de.libreoffice.org/

If you own an linux you can use the following command:

$ libreoffice --headless --invisible --convert-to pdf --outdir /Users/Nico/Desktop/pt /Users/Nico/Desktop/pt/*.pptx