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
http://www.klauskomenda.com/code/javascript-programming-patterns/#module |
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
//This will sort your array | |
function SortByName(a, b){ | |
var aName = a.name.toLowerCase(); | |
var bName = b.name.toLowerCase(); | |
return ((aName < bName) ? -1 : ((aName > bName) ? 1 : 0)); | |
} | |
array.sort(SortByName); |
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
You can pass a function to .replaceWith [docs]: | |
$('code').replaceWith(function(){ | |
return $("<pre />", {html: $(this).html()}); | |
}); | |
Inside the function, this refers to the currently processed code element. | |
Update: There is no big performance difference, but in case the code elements have other HTML children, appending the children instead of serializing them feels to be more correct: |
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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Runtime.Caching; | |
namespace CacheProject | |
{ | |
public class CacheLayer | |
{ | |
static readonly ObjectCache Cache = MemoryCache.Default; |
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
DECLARE @Tablename NVARCHAR(255) = 'MyTable' | |
DECLARE @IdColumn NVARCHAR(255) = 'MyTableId' -- Primarykey-Column, will be ignored | |
DECLARE @IdToCopyFrom VARCHAR(255) = '33' -- Copy from this ID | |
DECLARE @ColName NVARCHAR(255) | |
DECLARE @SQL NVARCHAR(MAX) = '' | |
DECLARE Table_Cursor CURSOR FOR | |
SELECT [B].[Name] | |
FROM SYSOBJECTS AS [A], SYSCOLUMNS AS [B] |
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
using (var client = new HttpClient()) | |
{ | |
var message = new HttpRequestMessage(HttpMethod.Post, url); | |
message.Headers.Add("Authorization", authKey); | |
message.Headers.Add("Audit",auditKey); | |
message.Content = new StringContent(content, new UTF8Encoding(), "application/json"); | |
var response = client.SendAsync(message).Result; |
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
class MyDirective implements ng.IDirective { | |
restrict = 'A'; | |
require = 'ngModel'; | |
templateUrl = 'myDirective.html'; | |
replace = true; | |
constructor(private $location: ng.ILocationService, private toaster: ToasterService) { | |
} | |
link = (scope: ng.IScope, element: ng.IAugmentedJQuery, attrs: ng.IAttributes, ctrl: any) => { |
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 { Component } from '@angular/core'; | |
import { Observable } from 'rxjs/Observable'; | |
import { Subject } from 'rxjs/Subject'; | |
import 'rxjs/add/observable/interval'; | |
import 'rxjs/add/operator/map'; | |
import 'rxjs/add/observable/merge'; | |
@Component({ | |
selector: 'app-root', | |
templateUrl: './app.component.html', |
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 { Component } from '@angular/core'; | |
import { Observable } from 'rxjs/Observable'; | |
import { Subject } from 'rxjs/Subject'; | |
import 'rxjs/add/observable/interval'; | |
import 'rxjs/add/operator/map'; | |
import 'rxjs/add/observable/merge'; | |
import 'rxjs/add/operator/startWith'; | |
import 'rxjs/add/operator/scan'; | |
@Component({ |
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 { Component } from '@angular/core'; | |
import { Observable } from 'rxjs/Observable'; | |
import { Subject } from 'rxjs/Subject'; | |
import 'rxjs/add/observable/interval'; | |
import 'rxjs/add/operator/map'; | |
import 'rxjs/add/observable/merge'; | |
import 'rxjs/add/operator/startWith'; | |
import 'rxjs/add/operator/scan'; | |
import 'rxjs/add/operator/mapTo'; |