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
@jwo
jwo / registrations_controller.rb
Created September 30, 2011 23:11
API JSON authentication with Devise
class Api::RegistrationsController < Api::BaseController
respond_to :json
def create
user = User.new(params[:user])
if user.save
render :json=> user.as_json(:auth_token=>user.authentication_token, :email=>user.email), :status=>201
return
else
@paulirish
paulirish / data-markdown.user.js
Last active February 6, 2024 10:41
*[data-markdown] - use markdown, sometimes, in your HTML
// ==UserScript==
// @name Use Markdown, sometimes, in your HTML.
// @author Paul Irish <http://paulirish.com/>
// @link http://git.io/data-markdown
// @match *
// ==/UserScript==
// If you're not using this as a userscript just delete from this line up. It's cool, homey.
@mourner
mourner / TileLayer.Common.js
Created February 11, 2012 23:11
Leaflet shortcuts for common tile providers
// Lefalet shortcuts for common tile providers - is it worth adding such 1.5kb to Leaflet core?
L.TileLayer.Common = L.TileLayer.extend({
initialize: function (options) {
L.TileLayer.prototype.initialize.call(this, this.url, options);
}
});
(function () {
@roman01la
roman01la / index.html
Created June 17, 2013 01:32
THREE.js scene setup with JSONLoader for OSM2WebGL demo
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
</head>
<body>
<div class="viewport"></div>
<script src="//cdnjs.cloudflare.com/ajax/libs/three.js/r58/three.min.js"></script>
<script src="//threejs.org/examples/js/controls/OrbitControls.js"></script>
@marcelosomers
marcelosomers / git-php-webhook.php
Last active May 13, 2024 12:10
A basic webhook for deploying updates to repos on Github to your local server
<?php
/**
* This script is for easily deploying updates to Github repos to your local server. It will automatically git clone or
* git pull in your repo directory every time an update is pushed to your $BRANCH (configured below).
*
* Read more about how to use this script at http://behindcompanies.com/2014/01/a-simple-script-for-deploying-code-with-githubs-webhooks/
*
* INSTRUCTIONS:
* 1. Edit the variables below
* 2. Upload this script to your server somewhere it can be publicly accessed
@jiemakel
jiemakel / output.rdf
Last active February 15, 2016 21:22 — forked from Abbe98/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: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>
@alee
alee / views.py
Last active March 24, 2024 19:00
example Django view function that can be used for Discourse SSO, i.e., Discourse delegates User authentication to Django
import base64
import hmac
import hashlib
from urllib import parse
from django.contrib.auth.decorators import login_required
from django.http import HttpResponseBadRequest, HttpResponseRedirect
from django.conf import settings
@login_required
@lucaswerkmeister
lucaswerkmeister / openrefine.service
Created April 14, 2018 12:30
systemd unit file for running OpenRefine as a system service
# /etc/systemd/system/openrefine.service
[Unit]
Description=OpenRefine data reconciliation tool
Documentation=http://openrefine.org/
[Service]
ExecStart=/opt/openrefine-2.8/refine -d %S/%p -x refine.headless=true
DynamicUser=yes
NoNewPrivileges=yes
StateDirectory=%p