Skip to content

Instantly share code, notes, and snippets.

View MartinKnopf's full-sized avatar
🏠
Mucho risky business

Martin Knopf MartinKnopf

🏠
Mucho risky business
View GitHub Profile
@MartinKnopf
MartinKnopf / gist:5273784
Created March 29, 2013 21:28
angular shadow on 120x135 box
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Elementschatten mit CSS3 Box Shadow</title>
<style>
body {
width: 500px;
margin: 100px auto;
}
@MartinKnopf
MartinKnopf / ExternalLink.java
Last active December 18, 2015 18:29
Wicket ExternalLink with Model<DTO>
@MartinKnopf
MartinKnopf / init null fields
Created June 28, 2013 22:49
how to init fields of a java class using annotations
@Retention(value=RUNTIME)
@Target({ElementType=FIELD})
public @interface DefaultIfNUll {
String stringValue();
int intValue();
boolean booleanValue();
byte byteValue();
short shortValue();
long longValue();
float floatValue();
@MartinKnopf
MartinKnopf / CssMerger.java
Last active December 19, 2015 06:49
Wicket: Merging multiple CSS files into one
package org.horsed.wicket.cssmerger;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.io.FileUtils;
import org.apache.wicket.markup.head.CssContentHeaderItem;
import org.apache.wicket.markup.head.CssHeaderItem;
@MartinKnopf
MartinKnopf / gist:6278650
Created August 20, 2013 08:25
Replace string in files
for f in `find -name FILENAME`; do cat $f | sed 's/STRING1/STRING2/g' > tmp.txt; mv tmp.txt $f; done
@MartinKnopf
MartinKnopf / checkout.js
Last active August 29, 2015 13:57
Code Kata #9 'Checkout' in JavaScript (see http://codekata.com/kata/kata09-back-to-the-checkout/)
var _ = require('lodash');
module.exports = Checkout;
function Checkout(pricingRules) {
this.pricingRules = pricingRules;
this.basket = {};
}
Checkout.prototype.scan = function(item) {
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
@MartinKnopf
MartinKnopf / PartiallyTransparentSprite.cs
Created August 20, 2015 13:18
Unity script and shader to apply partial transparency to a sprite (based on Unitys standard sprite shader)
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using Random = UnityEngine.Random;
public class PartiallyTransparentSprite : MonoBehaviour {
public SpriteRenderer renderer;
Material material;
List<Color> holes= new List<Color>();
@MartinKnopf
MartinKnopf / Eventz.cs
Last active November 20, 2015 00:29
Custom events using CSharp
using UnityEngine;
using System;
public class EventContainer : MonoBehaviour {
public class EmptyEvent {
public delegate void EmptyDelegate();
public event EmptyDelegate Event;
public void Emit() { if(Event != null) Event(); }
}
@MartinKnopf
MartinKnopf / steamspy_shortcut.js
Created July 3, 2017 14:27
Userscript for Steam app pages, that appends a link to the title, which leads to the corresponding steamspy page.
// ==UserScript==
// @name steamspy shortcut
// @namespace http:/flatbutton.co/
// @version 1.0
// @author Martin Knopf
// @match http://store.steampowered.com/app/*
// @grant none
// @require https://cdnjs.cloudflare.com/ajax/libs/zepto/1.1.4/zepto.min.js
// ==/UserScript==