Skip to content

Instantly share code, notes, and snippets.

View philipp-spiess's full-sized avatar

Philipp Spiess philipp-spiess

View GitHub Profile
def zeuge(a, n)
b = (n-1).to_s(2) # binary representation
d = 1
b.reverse.split('').each do |i|
d = (d*d) % n
if i.to_i == 1
d = (d*a) % n
end
puts "#{i}: #{d}"
@Test
public void testSeasonAndEpisodeNumberExtraction() {
LocalFileService localFileService = new LocalFileService()
File test1 = new File("Breaking.Bad.4.Days.Out.S02E09.mkv");
File test2 = new File("Breaking.Bad.4.Days.Out.02X09.mpg");
Assert.assertTrue(localFileService.hasPattern(test1));
Assert.assertTrue(localFileService.getSeason(test1) == 2);
Assert.assertTrue(localFileService.getEpisode(test1) == 9);
package sepm.ss15.e1325214.validators;
import sepm.ss15.e1325214.models.Jockey;
/**
* Specific validation behaviour for a jockey object
*
* @author philipp
*/
public class JockeyValidator extends Validator{
@philipp-spiess
philipp-spiess / Program.cs
Created February 22, 2012 19:04
Inheritance
using System;
namespace Inheritance
{
class Program
{
static void Main(string[] args)
{
Quadrat q = new Quadrat(123);
@philipp-spiess
philipp-spiess / Fussballer.cs
Created February 26, 2012 12:52
Polymorphismus C#
public class Fussballer : Sportler
{
public void DoSport()
{
Console.WriteLine("Fussball spielen!");
}
}
@philipp-spiess
philipp-spiess / apc.php
Created February 28, 2012 00:04
Le wild apc.php
<?php
/*
+----------------------------------------------------------------------+
| APC |
+----------------------------------------------------------------------+
| Copyright (c) 2006-2011 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@philipp-spiess
philipp-spiess / dabblet.css
Created February 29, 2012 21:02
Le awesome button test
/**
* Le awesome button test
*/
body {
background: url('http://dribbble.com/images/tile.gif');
}
button {
margin-left:50px;
@philipp-spiess
philipp-spiess / example.js
Created April 10, 2012 21:35 — forked from anonymous/example2.js
MongoDB CRUD and MapReduce
db.foo.insert( { name: "Mario", fach: ["E", "D"] } );
db.foo.insert( { name: "Philipp", fach: ["PR", "D"] } );
db.foo.find();
db.foo.find( { name: "Mario" } );
db.foo.find( { fach: { $in : [ "E", "M" ] } } );
db.foo.update( { name: "Mario" }, { $push: { fach: "M" } } );
db.foo.find( { name: "Mario" } );
@philipp-spiess
philipp-spiess / test.js
Created April 15, 2012 20:34
JavaScript Security Test
var Test = function() {
console.log("I'm not soo evil")
}
Test.prototype.play = function(arg) {
return arg + 1
}
module.exports = Test