Skip to content

Instantly share code, notes, and snippets.

View Abbe98's full-sized avatar
📧
Tons of notifications here, send me an email instead.

Albin Larsson Abbe98

📧
Tons of notifications here, send me an email instead.
View GitHub Profile
@Abbe98
Abbe98 / example.php
Created August 4, 2013 13:51
A PHP template for dealing with any sort of error, if you want to keep it simple. ErrorDocument: 400, 401, 403, 404, 405, 408, 414, 500, 502 and 504.
<?php
$status=$_SERVER['REDIRECT_STATUS'];
$codes=array(
400 => array('400 Bad Request', 'The request cannot be fulfilled due to bad syntax.'),
401 => array('401 Login Error', 'It appears that the password and/or user-name you entered was incorrect.'),
403 => array('403 Forbidden', 'Sorry, employees and staff only.'),
404 => array('404 Missing', 'We\'re sorry, but the page you\'re looking for is missing, hiding, or maybe it moved somewhere else and forgot to tell you.'),
405 => array('405 Method Not Allowed', 'The method specified in the Request-Line is not allowed for the specified resource.'),
408 => array('408 Request Timeout', 'Your browser failed to send a request in the time allowed by the server.'),
@Abbe98
Abbe98 / browserconfig.xml
Created December 30, 2013 14:28
Browserconfig.xml for IE 11
<browserconfig>
<msapplication>
<tile>
<square70x70logo src="img/smalltile.png"/>
<square150x150logo src="img/mediumtile.png"/>
<wide310x150logo src="img/widetile.png"/>
<square310x310logo src="img/largetile.png"/>
<TileColor>#FFF</TileColor>
</tile>
</msapplication>
@Abbe98
Abbe98 / password.php
Created March 12, 2014 17:21
Using the new PHP password API. Verify and rehash in one function.
function password_verify_with_rehash($password, $hash) {
if (!password_verify($password, $hash)) {
return false;
}
if (password_needs_rehash($hash, PASSWORD_DEFAULT)) {
$hash = password_hash($password, PASSWORD_DEFAULT);
// update hash in database
}
$date = '2014-10-20';
list($yyyy, $mm, $dd) = explode('-', $date);
if (!checkdate($mm, $dd, $yyyy)) {
echo 'Error: date';
}
$time = '00:00:00';
if (!preg_match('/\d{2}\:\d{2}\:\d{2}/', $time)) {
echo 'Error: time';
}
@Abbe98
Abbe98 / output.rdf
Last active February 19, 2016 12:41
RDF example/dummy output from the OpenStreetMap API(OpenHistoricalMap).
<?xml version="1.0"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:ohmdm="http://schemas.openhistoricalmap.org/#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:owl="http://www.w3.org/2002/07/owl#">
<rdf:Description xmlns:tags="http://schemas.openhistoricalmap.org/tag#" xmlns:element="http://schemas.openhistoricalmap.org/element#" rdf:about="http://www.openhistoricalmap.org/way/198179683">
<ohmdm:createdDate>2015-03-06</ohmdm:createdDate>
<ohmdm:latestChangeDate>2015-04-11</ohmdm:latestChangeDate>
<ohmdm:elementType rdf:resource="http://schemas.openhistoricalmap.org/element#way"/>
<ohmdm:osmVersion>0.6</ohmdm:osmVersion>
<ohmdm:osm format="XML">http://www.openhistoricalmap.org/api/0.6/way/198179683</ohmdm:osm>
<ohmdm:changeset>1141</ohmdm:changeset>
<a href="https://github.com/tmcw/report-a-bug"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_gray_6d6d6d.png" alt="Fork me on GitHub"></a>
@Abbe98
Abbe98 / output.ttl
Created February 6, 2016 10:32 — forked from jiemakel/output.ttl
OpenHistoricalMap example RDF as turtle
@prefix ohmdm: <http://schemas.openhistoricalmap.org/#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix dc: <http://purl.org/dc/elements/1.1/> .
@prefix tags: <http://schemas.openhistoricalmap.org/tag#> .
@prefix element: <http://schemas.openhistoricalmap.org/element#> .
<http://www.platsr.se/platsr/visa/plats/id/51000000025120>
@Abbe98
Abbe98 / rasp.md
Last active February 8, 2016 16:27

Rasbian Web Server

Termologi/"Allmänbildning Linux & Webservrar"

  • sudosubstitute user do kör kommand som admin
  • Paket alla program är i Linux distribuerade i så kallade paket
  • Apache världens vanligaste webserver
  • PHP Högnivåspråk för webapplikationer
  • MySQL En mycket vanlig SQL server
@Abbe98
Abbe98 / output.rdf
Last active February 19, 2016 12:20 — forked from jiemakel/output.rdf
RDF example/dummy output from the OpenStreetMap API(OpenHistoricalMap).
<?xml version="1.0"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:ohmdm="http://schemas.openhistoricalmap.org/#">
<rdf:Description rdf:about="http://www.openhistoricalmap.org/way/198179683">
<ohmdm:timestamp>2015-04-11</ohmdm:timestamp>
<ohmdm:elementType rdf:resource="http://schemas.openhistoricalmap.org/element#way"/>
<ohmdm:osmVersion>0.6</ohmdm:osmVersion>
<ohmdm:changeset>1141</ohmdm:changeset>
<ohmdm:version>8</ohmdm:version>
<ohmdm:user>Abbe98</ohmdm:user>
Coord Label
61.1503,10.6895 Sjusjøen, Hedmark, Norway
61.5826,8.40454 Visdalen, Oppland, Norway
59.53576,9.29699 Ramberg, Telemark, Norway
69.6444,19.1615 Vasstrand, Troms, Norway
59.0772,16.3699 Himlinge, Södermanland, Sweden
58.2701,13.7247 Stenstorp, Västra Götaland, Sweden