Skip to content

Instantly share code, notes, and snippets.

Avatar

Bernd Strehl Strernd

  • Hamburg, Germany
View GitHub Profile
View Laravel5Controllers
<?php namespace App\Http\Controllers;
class HomeController extends Controller {
}
View gist:954a345aff1af4c96337
<?php namespace App\Http\Controllers;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
abstract class CrudController extends Controller {
protected $model = null;
View ha24.py
import sys
def cross(X,Y):
l = sum = 0
for i in reversed(X):
sum = sum + i
if sum > l:
l = sum
r = sum = 0
for i in Y:
View cplex homework 1
/*********************************************
* OPL 12.7.0.0 Model
* Author: Bernd
* Creation Date: 26.11.2016 at 18:12:32
*********************************************/
range warehouses = 1..3;
range retailers = 1..4;
int cost[warehouses][retailers] = [[35,30,40,32],[37,40,42,25],[40,15,20,28]];
int stock[warehouses] = [1200,1000,800];
View tutorial 2
/*********************************************
* OPL 12.5.1.0 Model
* Author: BAT4769
* Creation Date: Dec 5, 2016 at 11:14:35 AM
*********************************************/
int n=4; // cargos
int m=3; // compartments
range cargos = 1..n;
View CHP Homework 2
/*********************************************
* OPL 12.5.1.0 Model
* Author: BAT4769
* Creation Date: Dec 5, 2016 at 11:14:35 AM
*********************************************/
int n=4; // cargos
int m=3; // compartments
int a=2; // aircrafts
View index.html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Voronoi</title>
</head>
View build.js
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
const Voronoi = require( 'voronoi' );
const _ = require( 'lodash' );
const canvas = document.getElementById( "canvas" );
const ctx = canvas.getContext( "2d" );
const v = new Voronoi();
const max = {
x: 800,
y: 800
};
View voronoi.js
const Voronoi = require( 'voronoi' );
const _ = require( 'lodash' );
const canvas = document.getElementById( "canvas" );
const ctx = canvas.getContext( "2d" );
const v = new Voronoi();
const max = {
x: 800,
y: 800
};
const bbox = {
View AdvertMarket.sol
pragma solidity ^0.4.24;
import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
contract AdvertMarket is Ownable{
event NewAdvert(uint id, bytes32 meta, uint price, address sender);
event AdvertChangedOwner(uint id, uint price, address newOwner, uint newPrice);
event AdvertDataChanged(uint id, bytes32 data);
uint maxPriceFactor = 2; // max factor the price can increase at owner change