This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)mapView:(MKMapView *)mv didAddAnnotationViews:(NSArray *)views { | |
for(MKAnnotationView *annotationView in views) { | |
if(annotationView.annotation == mv.userLocation) { | |
MKCoordinateRegion region; | |
MKCoordinateSpan span; | |
span.latitudeDelta=0.05; | |
span.longitudeDelta=0.05; | |
CLLocationCoordinate2D location=mv.userLocation.coordinate; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ScriptObjectLoader { | |
public static ScriptEngineManager scriptEngineManager; | |
public static ScriptEngine engine; | |
static { | |
scriptEngineManager = new ScriptEngineManager(); | |
engine = scriptEngineManager.getEngineByName("JavaScript"); //Or whatever | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@implementation NSManagedObject (NSManagedObject_JSON) | |
/* | |
* | |
* This method is implemented to help NSObject+JSON with transforming to JSON as per SBJSON's JSONValue helper method. | |
* | |
*/ | |
-(NSDictionary*) proxyForJson { | |
NSDictionary * attributes = [[self entity] attributesByName]; | |
NSDictionary * relationships = [[self entity] relationshipsByName]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Usage example: | |
* var MongoConnection = require('./mongoconnection').MongoConnection; | |
* mongo_connection = new MongoConnection(process.env.MONGOHQ_URL); | |
* | |
* See also: https://github.com/christkv/node-mongodb-native | |
* | |
* Hat tip to: http://howtonode.org/express-mongodb | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
try { | |
var s = d.createElement("script"); | |
s.setAttribute("type","text/javascript"); | |
s.setAttribute("src","http://<myhost>/<myscript>.js?t="+(new Date().getTime())); | |
b.appendChild(s); | |
} | |
catch(e) { | |
alert(e); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Extend an Object from another Object. | |
* @param child | |
* @param parent | |
* @param proto - prototype mixins | |
* @returns {*} | |
*/ | |
function(child, parent, proto) { | |
//Constructor | |
var properties = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Promisify(obj) { | |
var original = Object.getPrototypeOf(obj); | |
var Promise = function Promise() { | |
this._chain = []; | |
}; | |
Promise.prototype = Object.create(Promise, { | |
constructor : { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
var assert = require('assert'); | |
var https = require('https'), | |
fs = require('fs'); | |
describe('SSL Connection', function () { | |
var server, server_options; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.eclipse.jetty.util.ssl.SslContextFactory; | |
import org.eclipse.jetty.server.Connector; | |
import org.eclipse.jetty.server.Server; | |
import org.eclipse.jetty.server.nio.SelectChannelConnector; | |
import org.eclipse.jetty.server.ssl.SslSelectChannelConnector; | |
import org.eclipse.jetty.webapp.WebAppContext; | |
public class TestServer { | |
public static void main(String[] args) throws Exception { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
function attempt(fn) { | |
return Object.create({ | |
'fail': function (onError) { | |
try { | |
fn(); | |
} | |
catch (e) { | |
return onError(e); |
OlderNewer