Skip to content

Instantly share code, notes, and snippets.

@kylewm
kylewm / gist:c2d69b7e5b2fc0845bbc
Created September 5, 2014 17:52
redwind profiling run
PATH: '/'
209894 function calls (208101 primitive calls) in 0.922 seconds
Ordered by: cumulative time, internal time
List reduced from 1025 to 60 due to restriction <60>
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.000 0.000 0.925 0.925 /home/kmahan/redwind/venv/local/lib/python3.3/dist-packages/werkzeug/contrib/profiler.py:91(runapp)
1 0.000 0.000 0.925 0.925 /home/kmahan/redwind/venv/local/lib/python3.3/dist-packages/flask/app.py:1787(wsgi_app)
1 0.000 0.000 0.921 0.921 /home/kmahan/redwind/venv/local/lib/python3.3/dist-packages/flask/app.py:1463(full_dispatch_request)
'------------------3D Pong---------------
'----------------BY KYLE MAHAN-----------
'Use the mouse to hit the ball...
'YOU CAN CHANGE THE GRAVITY, PADDLE HEIGHT AND WIDTH WITH THE OPTIONS SCREEN.
'THERE ARE ALSO SOME CODES THAT CAN BE TYPED AT THE OPTIONS SCREEN.
'The codes can only be typed one at a time. The first is THINK PAD. It will
'give you 100 points for every paddle hit. The second is CROSSHAIRS. This
'gives you a cross on the ball. The third is slope[n]. n can be from 1 to 9
'This changes the paddle's slope depending on the n.
'Declarations
@kylewm
kylewm / GradleDependencyExample.md
Last active December 21, 2015 11:19
Gradle: question about dependency on an alternate configuration within a multi-project build

settings.gradle:

include 'core'
include 'plugin'

build.gradle:

project('core') {
 apply plugin: 'java'
@kylewm
kylewm / gist:5613537
Created May 20, 2013 16:53
Testing gradle duplicate handling behavior
package org.gradle.api.internal.file.copy
import org.gradle.api.Project
import org.gradle.api.file.FileTree
import org.gradle.api.file.FileVisitDetails
import org.gradle.api.file.RelativePath
import org.gradle.testfixtures.ProjectBuilder
import spock.lang.Shared
import spock.lang.Specification
public class DynamicDispatch {
interface GeometricValue {
void intersects(GeometricValue v);
}
static class Point implements GeometricValue {
@Override
public void intersects(GeometricValue v) {
throw new UnsupportedOperationException();
@kylewm
kylewm / gist:4978663
Last active December 13, 2015 21:38
For "Java Infinite Streams" discussion on Coursera
class Cons<T, R> {
T car;
R cdr;
Cons(T car, R cdr) {
this.car = car;
this.cdr = cdr;
}
@kylewm
kylewm / BuildWithCMakeMojo.java
Created December 10, 2012 04:25
First attempt at a Maven plugin that delegates to CMake
import java.io.*;
import java.util.*;
import org.apache.maven.plugin.*;
import org.apache.maven.plugin.logging.Log;
/**
*
* @author kmahan
@kylewm
kylewm / gist:4207318
Created December 4, 2012 18:39
Ah, maven
$ sudo apt-get install maven
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
ant ant-optional aspectj bsh bsh-gcj fop gcj-4.6-base gcj-4.6-jre-lib
glassfish-javaee java-wrappers junit junit4 libaether-java libantlr-java
libaopalliance-java libapache-pom-java libasm3-java libaspectj-java
libasync-http-client-java libatinject-jsr330-api-java
libavalon-framework-java libbackport-util-concurrent-java libbatik-java
@kylewm
kylewm / compilers_ast_to_dot.java
Created November 4, 2012 16:04
export AST to GraphViz DOT file
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.lang.reflect.Field;
public class AstToDot {
/**
* @param args
* @throws Exception