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
CREATE PROCEDURE GenerateWarehouseTbl | |
AS | |
BEGIN | |
-- create warehouse table | |
CREATE TABLE IMQCDev.dbo.Warehouses ( id int IDENTITY(1,1) NOT NULL, name varchar(50) NOT NULL, siteId varchar(50) NOT NULL, PRIMARY KEY(id), UNIQUE(name, siteId) ); | |
-- fetch warehouses from IMQCdev and insert into warehouses table | |
INSERT INTO IMQCDev.dbo.Warehouses (name, siteId) SELECT DISTINCT SUBSTRING(CONVERT(varchar(10), WhseLocID), 0, 3) as WhseName, SiteID as SiteId FROM IMQCDev.dbo.WhseLocDesc WHERE WhseLocID >= 10000 ORDER BY WhseName asc; |
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(ctx, $, undefined){ | |
$(document).ready(function(){ | |
bindEvent(); | |
}) | |
function bindEvent () { | |
//private scope for application | |
} |
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
(1..100).each do |n| | |
if(n%3 == 0 && n%5 == 0) | |
puts 'TitForTat' | |
elsif(n%3 == 0) | |
puts 'Tit' | |
elsif(n%5 == 0) | |
puts 'Tat' | |
else | |
puts n | |
end |
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 _u = {}; | |
_u.log = function() { | |
var _time = new Date(); | |
var time = ( _time.getHours() | |
+ ":" + _time.getMinutes() | |
+ ":" + _time.getSeconds() | |
+ ":" + _time.getMilliseconds()); | |
var LOG_PREFIX = "[TREENI] - " + time; | |
var args = Array.prototype.slice.call( arguments ); | |
args.unshift( LOG_PREFIX + " ::" ); |
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 collectionObject = [{id: 1}, {id: 2}, {id: 3}, {id: 4}] | |
var ids = [2,3] | |
_.filter(collectionObject, function(ca){ | |
return _.contains(ids, ca.id) | |
}) |
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
Sample.controller('SampleController', | |
[ | |
'$scope', | |
'$window', | |
'$location', | |
'SampleFactory', | |
'SampleService' | |
function ($scope, $window, $location, SampleFactory, SampleService) { |
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
// Factory can have another factory, $rootScope as dependancy but not $scope | |
Sample.factory('SampleFactory', ['$window', '$rootScope', 'AnotherFactory', function (_, $window, $rootScope, AnotherFactory) { | |
var factory = {} | |
factory.method1 = function() {}; | |
factory.method2 = function() {}; | |
return factory; |
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
Sample.service('SampleService', ['$http', '$q', function($http, $q) { | |
this.getData = function () { | |
var deferred = $q.defer(); | |
var url = Config.GET_DATA_ENDPOINT; | |
$http({ | |
url: url, | |
method: "GET" | |
}).success(function (data) { |
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
workflow: { | |
states: [ | |
{ index: 0, name: "abc" }, | |
{ index: 1, name: "xyz" } | |
], | |
moves: [ | |
{ index: 0, | |
from_state_id: 0, | |
to_state_id: 1, |
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
# Set current time to API request time zone | |
Time.zone = 'Eastern Time (US & Canada)' | |
=> "Eastern Time (US & Canada)" | |
# Initialize api request time in api time zone | |
t = Time.zone.local(2015, 'may', 18, 9,10,30) | |
=> Mon, 18 May 2015 09:10:30 EDT -04:00 | |
# Convert requested time to utc time | |
time_in_utc = t.utc |