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
const angular = require("angular"); | |
angular | |
.module("modulename") | |
.directive('attachFocusFunction', function($parse) { | |
return { | |
scope: false, | |
link(scope, element, attributes) { | |
let expr = $parse(attributes.attachFocusFunction); | |
if(!expr.assign){ |
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
// traditional version | |
function toggleValueInArray1(val, arr) { | |
var ix = arr.indexOf(val); | |
if(ix === -1){ | |
// add to array | |
arr.push(val); | |
} | |
else | |
{ | |
// remove from array |
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 ko from 'knockout'; | |
import $ from 'jquery'; | |
var templateFromUrlLoader = { | |
loadTemplate(name, templateConfig, callback) { | |
if (templateConfig.fromUrl) { | |
var fullUrl = templateConfig.fromUrl; | |
$.get(fullUrl, markupString => { | |
ko.components.defaultLoader.loadTemplate(name, markupString, callback); | |
}); |
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 StackExchange.Redis; | |
namespace ConsoleApplication1 | |
{ | |
public static class RedisExtensions | |
{ | |
public static RedisValue Get(this IDatabase db, RedisKey key, Func<RedisValue> loadFunc, TimeSpan slidingDuration) | |
{ | |
var ret = db.StringGet(key); |
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 () { | |
"use strict"; | |
function parse(querystring) { | |
var obj = {}; | |
if (querystring) { | |
var params = querystring.split(/&|\?/); | |
for (var i = 0; i < params.length; i++) { | |
var param = params[i]; |
NewerOlder