Skip to content

Instantly share code, notes, and snippets.

package com.twu;
public class Square extends Rectangle {
public Square(int side) {
super(side, side);
}
}
@sudhirj
sudhirj / Rectangle.java
Created October 4, 2011 07:13
OOP Step 1
package com.twu;
public class Rectangle {
private final int length;
private final int breadth;
public Rectangle(int length, int breadth) {
this.length = length;
this.breadth = breadth;
use ActionDispatch::Static
use Rack::Chunked
use Rack::Deflater
use Rack::Lock
use #<ActiveSupport::Cache::Strategy::LocalCache::Middleware:0x000001048a2258>
use Rack::Runtime
use Rack::MethodOverride
use Rails::Rack::Logger
use ActionDispatch::ShowExceptions
use ActionDispatch::RemoteIp
@sudhirj
sudhirj / gist:1046676
Created June 25, 2011 17:21
The REPL made by Tipfy for a GAE project and SDK.
#!/opt/local/Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app/Contents/MacOS/Python
import os
join = os.path.join
base = os.path.dirname(os.path.abspath(os.path.realpath(__file__)))
base = os.path.dirname(base)
import sys
public static BoundingBox from(List<Point> points) {
Preconditions.checkArgument(!points.isEmpty());
GeoPt base = points.get(0).getPosition();
Position southWestBase = Position.from(base);
Position northEastBase = Position.from(base);
for (Point point : points) {
southWestBase = southWestBase.moveSouthWest(Position.from(point.getPosition()));
northEastBase = northEastBase.moveNorthEast(Position.from(point.getPosition()));
}
return new BoundingBox(southWestBase, northEastBase);
public class ShareWidget extends Composite {
private static ShareWidgetUiBinder uiBinder = GWT.create(ShareWidgetUiBinder.class);
interface ShareWidgetUiBinder extends UiBinder<Widget, ShareWidget> {
}
public ShareWidget() {
initWidget(uiBinder.createAndBindUi(this));
}
import sbt._
class Plugins(info: ProjectInfo) extends PluginDefinition(info) {
val appenginePlugin = "net.stbbs.yasushi" % "sbt-appengine-plugin" % "2.1" from "http://github.com/downloads/Yasushi/sbt-appengine-plugin/sbt-appengine-plugin-2.1.jar"
val sbtIdeaRepo = "sbt-idea-repo" at "http://mpeltonen.github.com/maven/"
val sbtIdea = "com.github.mpeltonen" % "sbt-idea-plugin" % "0.1-SNAPSHOT"
}
public class GeocoderWrapper {
private final Geocoder geocoder;
private String currentSearchTerm;
public interface GeocodeCompletionCallback {
void onGeocode(BoundingBox box);
}
//------------
//jQueryNS.js
//------------
$.ns = function(namespace) {
var names = namespace.split('.'), context = window || global, name = null;
while (name = names.shift())
context = context[name] === undefined ? context[name] = {} : context[name];
return context;
};