class Duck {
def walk() { println "I'm a duck, I walk" }
def swim() { println "I'm a duck, I swim" }
def quack() { println "QUACK" }
}
class Person {
| parse_git_branch() { | |
| git branch --no-color 2>/dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ \1 /' | |
| } | |
| gitps1() { | |
| local GREEN="\[\033[0;32m\]" | |
| local DEFAULT="\[\033[0m\]" | |
| PS1="[\u@\h \W]$GREEN\$(parse_git_branch)$DEFAULT\$ " | |
| } | |
| gitps1 |
| import java.util.List; | |
| public class Sieve { | |
| static List<Integer> sieve(int n) { | |
| List<Integer> l = new java.util.ArrayList<Integer>(); | |
| byte[] bs = new byte[(n / 8) + 1]; // 0 => maybe prime | |
| bs[0] = (byte) 0xc0; // skip 0 and 1 | |
| for (int i = 2; i <= n / 2; i++) { | |
| for (int c = i; c <= n; c += i) { | |
| int bidx = c / 8; |
| import os | |
| import sys | |
| import BaseHTTPServer | |
| from SimpleHTTPServer import SimpleHTTPRequestHandler | |
| pid = os.fork() | |
| if pid != 0: | |
| print "Server PID is", pid | |
| sys.exit() |
| #!/bin/bash | |
| echo Switching to Java $1 | |
| OLD_JAVA_HOME=$JAVA_HOME | |
| if [ "$1" == "1.6" -o "$1" == "6" -o "$1" == "6.0" ]; then | |
| export JAVA_HOME=/usr/lib/jvm/java-1.6.0 | |
| elif [ "$1" == "1.7" -o "$1" == "7" -o "$1" == "7.0" ]; then | |
| export JAVA_HOME=/usr/lib/jvm/java-1.7.0 |
| #!/bin/bash | |
| POMDIR=$(pwd) | |
| while [[ "$POMDIR" != "/" && ! -f "$POMDIR/pom.xml" ]]; do | |
| POMDIR=$(dirname "$POMDIR") | |
| done | |
| if [[ "$POMDIR" != "/" ]]; then | |
| cd "$POMDIR" | |
| else |
| <html> | |
| <head><title>Character Escapes</title> | |
| <style type="text/css"> | |
| body { | |
| font-family: sans-serif; | |
| margin-top: 1in; | |
| } | |
| p { | |
| font-size: large; | |
| text-align: center; |
| #!/usr/bin/python | |
| import calendar | |
| from datetime import datetime | |
| from optparse import OptionParser | |
| import sys | |
| # Define command line options: -D, -f, -F. | |
| op = OptionParser() | |
| op.add_option('-D', '--date', dest='date_to_use', | |
| help='UTC date to use instead of now, as %Y%m%d%H%M') |
| import sublime, sublime_plugin | |
| from os import listdir | |
| from os.path import commonprefix | |
| from os.path import isdir | |
| #from os import getenv | |
| from os import getcwd | |
| from os import sep | |
| class PromptOpenFilePathCommand(sublime_plugin.WindowCommand): |
| #!/bin/sh | |
| # Written by Mike Ensor (mike@ensor.cc) | |
| # Copywrite 2012 | |
| # Use as needed, modify, have fun! | |
| # Modified by Bill Havanki | |
| # This was intended to be used for Maven3 + Mac OSX, but it's been modified for Cygwin and Linux. | |
| # Maybe it still works on OSX? | |
| # Changes from original: | |
| # - Cygwin support |