Skip to content

Instantly share code, notes, and snippets.

//------------
//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;
};
public class GeocoderWrapper {
private final Geocoder geocoder;
private String currentSearchTerm;
public interface GeocodeCompletionCallback {
void onGeocode(BoundingBox box);
}
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 ShareWidget extends Composite {
private static ShareWidgetUiBinder uiBinder = GWT.create(ShareWidgetUiBinder.class);
interface ShareWidgetUiBinder extends UiBinder<Widget, ShareWidget> {
}
public ShareWidget() {
initWidget(uiBinder.createAndBindUi(this));
}
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);
@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
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 / 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;
package com.twu;
public class Square extends Rectangle {
public Square(int side) {
super(side, side);
}
}
@sudhirj
sudhirj / gist:3213493
Created July 31, 2012 04:04
Method Behind Madness: The Real Reason Apple Made Those Ads

Apple recently released a [set][ad1] of [new][ad2] [ads][ad3] that have met with widespread criticism from the tech community. While I don't really like the ads myself, it actually seems like a good idea for Apple to have made them.

The moment I looked at them here's what came to mind: Apple has moved on. The geeks of the world are no longer prime targets for Apple. Neither are our friends and acquaintances. If you've read [Crossing the Chasm][ctc], Moore talks about five kinds of audiences that need to be addressed: innovators, early adopters, early majority, late majority and laggards. Any guesses which group Apple needs to target now? No? Didn't think so.

Apple has already finished marketing to us (if you're reading this off HN or Reddit, people like you and me), our circle of friends, and our friend's friends. There isn't anyone in these three circles who doesn't know what Apple, Macs, iPhones, iPads and iPods