Arnar Yngvason demux

View request.php
1 2 3 4 5 6 7 8 9 10
function R($param, $default=null, $type='string') {
if(!isset($_REQUEST[$param]))
return $default;
$r = $_REQUEST[$param];
if($type === 'bool' || $type === 'boolean') {
if($r === 'false' || $r === 'no')
return false;
return !empty($r);
}
settype($r, $type);
View nearSort.js
1 2 3 4 5 6 7 8 9 10
function nearestInList(number, list, returnDistance) {
var distance = Infinity;
var n = null;
for(var i in list) {
var _distance = Math.abs(list[i] - number);
if(_distance < distance) {
distance = _distance;
n = list[i];
}
View 0_reuse_code.js
1 2
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
View exchange-rates.php
1 2 3 4 5 6 7 8 9 10
<?php
 
$xml_url = 'http://www.arionbanki.is/markadir/gjaldmidlar/gengi/xml-export';
$data = simplexml_load_file($xml_url);
 
$out = array(
'timestamp' => time(),
'base' => 'ISK',
'rates' => array()
);
View lp_upload_unittest.py
1 2 3 4 5 6 7 8 9
# -*- coding: utf-8 -*-
 
from django.utils import unittest
from django.test.client import Client
import simplejson as json
import hashlib
from settings import PROJECT_PATH
 
from main.models import Event
View parseApache2clickheat.py
1 2 3 4 5 6 7 8 9
#! /usr/bin/python
 
import os
import re
 
in_log_path = '/var/log/apache2/clickheat/'
out_log_path = '/var/www/clickheat/logs/'
 
site_files = []
Something went wrong with that request. Please try again.