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 static void AttachOrUpdate<T>(this ObjectSet<T> set, ref T entity) where T : class | |
{ | |
ObjectContext context = set.Context; | |
string entitySetName = set.EntitySet.Name; | |
ObjectStateEntry entry; | |
bool isDetached = true; | |
if (context.ObjectStateManager.TryGetObjectStateEntry( | |
context.CreateEntityKey(entitySetName, entity), |
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
// Overrides "some_function" | |
some_function = function () { | |
var orig_function = some_function; | |
return function () { | |
// call the original function | |
orig_function.apply(this, arguments); | |
// do other stuff | |
}; |
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 (window, undefined) { | |
var privateVariable = null; | |
var exampleObject = { | |
publicMethodOne: function () {}, | |
publicMethodTwo: function () {} | |
}; | |
// Expose exampleObject to the global object | |
window.exampleObject = exampleObject; |
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() { | |
... | |
var exampleObject = (function() { | |
var privateVariable = null; | |
function privateMethod() { ... } | |
this.publicMethodOne = function() { ... } | |
this.publicMethodTwo = function() { ... } |
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
var DED = (function() { | |
var private_var; | |
function private_method() | |
{ | |
// do stuff here | |
} | |
return { |
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 getZoomFromRadius(radius) { | |
// Calculates the target zoom level given a radius in miles | |
var mapDiv = $("#map"); | |
var mapWidth = mapDiv.width(); | |
var mapHeight = mapDiv.height(); | |
var radiusMeters = radius * 1609.34; // converting miles to meters | |
var diameter = radiusMeters * 2; | |
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
routes.MapHttpRoute( | |
name: "DefaultApiWithAction", | |
routeTemplate: "api/{controller}/{action}/{id}", | |
defaults: new { id = RouteParameter.Optional }, | |
constraints: new { action = @"^[^\d].*$" } | |
); | |
routes.MapHttpRoute( | |
name: "DefaultApiWithId", | |
routeTemplate: "api/{controller}/{id}", |
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
L.ImageOverlay.WMS = L.ImageOverlay.extend({ | |
defaultWmsParams: { | |
service: 'WMS', | |
request: 'GetMap', | |
version: '1.1.1', | |
layers: '', | |
styles: '', | |
format: 'image/jpeg', | |
transparent: false, |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Basic example</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.6.2/leaflet.css" /> | |
<!--[if lte IE 8]><link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.6.2/leaflet.ie.css" /><![endif]--> | |
<style type="text/css"> |
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
define(function (require) { | |
var module; | |
// Setup temporary Google Analytics objects. | |
window.GoogleAnalyticsObject = "ga"; | |
window.ga = function () { (window.ga.q = window.ga.q || []).push(arguments); }; | |
window.ga.l = 1 * new Date(); | |
// Immediately add a pageview event to the queue. |
OlderNewer