This file contains hidden or 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
-- Thanks to: http://pratchev.blogspot.com/2008/11/import-xml-file-to-sql-table.html | |
INSERT INTO Equipment (Id, Location, Unit, FullDescription, Equipment, PressureRating, Quantity, ReactorMaterialOfConstruction, ReactorCapacityGallons) | |
SELECT X.equipment.value('@id', 'INT'), | |
X.equipment.query('Location').value('.', 'VARCHAR(500)'), | |
X.equipment.query('Unit').value('.', 'VARCHAR(50)'), | |
X.equipment.query('Full_description').value('.', 'VARCHAR(500)'), | |
X.equipment.query('Equipment').value('.', 'VARCHAR(50)'), | |
X.equipment.query('Pressure_Rating').value('.', 'VARCHAR(50)'), | |
X.equipment.query('Quantity').value('.', 'VARCHAR(50)'), |
This file contains hidden or 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
// Get the injector | |
var injector = angular.element($0/*'[data-ng-app], [ng-app]'*/).injector(); | |
// Get the service | |
var Service = injector.get('Service'); | |
// Use it! | |
// Service.addNotification('Some Notification', 'info'); |
This file contains hidden or 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
<script type="text/ng-template" id="one.html"> | |
<div>This is first template</div> | |
</script> | |
<script type="text/ng-template" id="two.html"> | |
<div>This is second template</div> | |
</script> |
This file contains hidden or 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
angular.module('app', []) | |
.run(['$route', '$http', '$templateCache', function($route, $http, $templateCache) { | |
// Cache all templates on App Start | |
angular.forEach($route.routes, function(r) { | |
if (r.templateUrl) { | |
$http.get(r.templateUrl, {cache: $templateCache}); | |
} | |
}); | |
}); |
This file contains hidden or 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 () { | |
'use strict'; | |
var cache = {}; | |
function factorial(number) { | |
var keyResult; | |
var cacheKey = number.toString(); | |
console.log('Calculating factorial for ' + number); | |
if (cache[cacheKey]) { |
This file contains hidden or 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 root = $($0); | |
var watchers = []; | |
var f = function (element) { | |
if (element.data().hasOwnProperty('$scope')) { | |
angular.forEach(element.data().$scope.$$watchers, function (watcher) { | |
watchers.push(watcher); | |
}); | |
} |
This file contains hidden or 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 svc = { | |
new: function() { | |
function _p8(s) { | |
var p = (Math.random().toString(16)+"000000000").substr(2,8); | |
return s ? "-" + p.substr(0,4) + "-" + p.substr(4,4) : p ; | |
} | |
return _p8() + _p8(true) + _p8(true) + _p8(); | |
}, | |
empty: function() { |
This file contains hidden or 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 repaint(){ | |
document.body.removeChild(document.body.appendChild(document.createElement('style'))); | |
} |
This file contains hidden or 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
/** | |
* Example of using an angular provider to build an api service. | |
* @author Jeremy Elbourn ([email protected]) | |
*/ | |
/** Namespace for the application. */ | |
var app = {}; | |
/******************************************************************************/ |
This file contains hidden or 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
jQuery.fn.withOverflowingChildren = function (cb) { | |
var parent = jQuery(this); | |
var p = parent.get(0); | |
var children = parent.find('> *'); | |
var len = children.length | |
var parentCoords = p.getBoundingClientRect(); | |
var called = false | |
while(len){ | |
if(!isInParent(children.get(len -1))){ |