Skip to content

Instantly share code, notes, and snippets.

@luniki
luniki / timestamp.sql
Created February 28, 2018 10:30
CliqrPlugin timestamp Migration
ALTER TABLE etask_tasks ADD `mkdate` INT(11) NOT NULL AFTER `created`, ADD `chdate` INT(11) NOT NULL AFTER `changed`;
UPDATE etask_tasks SET mkdate = UNIX_TIMESTAMP(created), chdate = UNIX_TIMESTAMP(changed);
ALTER TABLE etask_tasks DROP `created`, DROP `changed`;
ALTER TABLE etask_tests ADD `mkdate` INT(11) NOT NULL AFTER `created`, ADD `chdate` INT(11) NOT NULL AFTER `changed`;
UPDATE etask_tests SET mkdate = UNIX_TIMESTAMP(created), chdate = UNIX_TIMESTAMP(changed);
ALTER TABLE etask_tests DROP `created`, DROP `changed`;
ALTER TABLE etask_responses ADD `mkdate` INT(11) NOT NULL AFTER `created`, ADD `chdate` INT(11) NOT NULL AFTER `changed`;
UPDATE etask_responses SET mkdate = UNIX_TIMESTAMP(created), chdate = UNIX_TIMESTAMP(changed);
@luniki
luniki / showDialog.js
Created September 26, 2016 08:14
STUDIP.Dialog und Backbone.View
import Backbone from 'backbone'
import _ from 'underscore'
import Promise from 'bluebird'
const showDialog = function (backboneView, dialogOptions) {
return new Promise(function (resolve, reject) {
const hygenicDialogClass = _.uniqueId('cliqr--dialog-')
@luniki
luniki / showDialog.js
Created September 26, 2016 08:13
STUDIP.Dialog und Backbone.View
import Backbone from 'backbone'
import _ from 'underscore'
import Promise from 'bluebird'
const showDialog = function (backboneView, dialogOptions) {
return new Promise(function (resolve, reject) {
const hygenicDialogClass = _.uniqueId('cliqr--dialog-')
@luniki
luniki / 01-vorher.php
Last active December 20, 2015 19:28
Stud.IP: Vergleich eines Fake-Logins für 2.3 und später
<?
protected function start_session($user_id)
{
global $perm, $user, $auth, $sess, $forced_language, $_language;
$user = new Seminar_User();
$user->start($user_id);
@luniki
luniki / drop.sh
Created August 2, 2013 09:58
Drop all tables
MYSQL="mysql -h HOST -u USERNAME -pPASSWORD -D DB_NAME"
$MYSQL -BNe "show tables" | awk '{print "set foreign_key_checks=0; drop table `" $1 "`;"}' | $MYSQL
unset MYSQL
@luniki
luniki / halt.php
Last active December 19, 2015 23:59
#halt
<?
function words($string)
{
return preg_split('/ /', $string, -1, PREG_SPLIT_NO_EMPTY);
}
function halt(/* [status], [headers], [body] */)
{
$args = func_get_args();
@luniki
luniki / gist:6006552
Last active December 19, 2015 19:29
RouterMap.php-Methoden
<?
class RouteMap {
// [...]
// TODO (mlunzena): Implement these
// Set the Content-Type of the response body given a media type or
// file extension.
@luniki
luniki / StudipDispatcher.php
Created June 25, 2013 08:18
StudipDispatcher
<?php
/**
* StudipDispatcher.php - create the default Trails dispatcher
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
// Generated by CoffeeScript 1.5.0
(function() {
var $, dialog, dialog_template, getCid, getWikiPages, intermap, openLinkDialog, url;
$ = jQuery;
dialog_template = _.template("<div title='Stud.IP-Link einf&uuml;gen'>\n <select>\n <% _.each(keywords, function(keyword) { %>\n <option><%= keyword %></option> <% }); %>\n </select>\n <button class=submit>Einf&uuml;gen</button>\n</div>");
url = function(cid) {
return STUDIP.ABSOLUTE_URI_STUDIP + ("plugins.php/restipplugin/api/courses/" + cid + "/wiki");
<?php
/**
*
**/
class UserRoute implements APIRoute
{
/**
*
**/