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
/// <summary> | |
/// Implements a cache helper. | |
/// Taken from http://codereview.stackexchange.com/questions/25907/asp-net-caching-helper (comments added). | |
/// </summary> | |
public static class CacheHelper | |
{ | |
/// <summary> | |
/// Retrieve the specified item from the cache if it is cached. Otherwise, insert it to the cache. | |
/// Note: of the cache is not available, the <paramref name="initializer"/> method may be called on every call. | |
/// </summary> |
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
public static class NLogExtensions | |
{ | |
public static void WarnIf(this NLog.ILogger @this, bool condition, string message) | |
{ | |
if (condition && @this.IsWarnEnabled) | |
{ | |
@this.Warn(message); | |
} | |
} | |
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
#!/usr/bin/env node | |
/** | |
* After prepare, files are copied to the platforms/[platform] folder. | |
* Lets clean up some of those files that arent needed with this hook. | |
*/ | |
var fs = require('fs'); | |
var path = require('path'); | |
var rootdir = process.argv[2]; |
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
-- réduire les LOGS | |
BACKUP LOG [Concours] TO DISK = N'E:\Backup\Concours-logs.bak' | |
USE [Concours] | |
ALTER DATABASE [Concours] SET RECOVERY SIMPLE WITH NO_WAIT | |
DBCC SHRINKFILE(Concours_Log, 1) | |
ALTER DATABASE [Concours] SET RECOVERY FULL WITH NO_WAIT | |
-- réduire le fichier de 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
from queue_db import QueuedWriter | |
from pymongo import Connection | |
from flask import Flask | |
from json import dumps | |
def main(): | |
'''This is just an example using Flask and MongoDB/pymongo. | |
Of course, you can use any web server and any database as long as you set up the methods appropriately''' |
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
<pre> | |
(function(length, prefix, suffix, map) { | |
/* Version 1.0 */ | |
var p = location.hostname.split('.'); | |
// Find service name | |
do { var pass = p.pop(); } | |
while (p.length && pass.length <= 3); | |
// First time assume domain | |
if (!this._custom_) { | |
this._custom_ = true; |
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
# this requires NuGet to be installed, so it will bring the PowerShell command line | |
# and the EnvDTE object. See: https://msdn.microsoft.com/en-us/library/EnvDTE.aspx | |
function DoItOnProjectItem($item) { | |
$doc = $item; | |
if ($doc.Name -match "\.cs$") { | |
write-host $doc.Name; | |
# open and display document | |
$foo = $doc.Open("{7651A701-06E5-11D1-8EBD-00A0C90F26EA}"); # vsViewKindCode -> to display code window |
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
using System; | |
class Benchmarker | |
{ | |
const int NB_RUN = 5; | |
public static void Benchmark(Action testMethod, string testName = null, bool blankRun = false) | |
{ | |
if (string.IsNullOrEmpty(testName)) | |
testName = testMethod.Method.Name; |
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
using System; | |
using System.Collections.Generic; | |
using System.ComponentModel; | |
using System.Linq; | |
namespace Untunh.Helpers | |
{ | |
/// <summary> | |
/// Provides a set of static methods for querying objects that represent an enumeration. | |
/// </summary> |
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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
namespace Untunh.Helpers | |
{ | |
/// <summary> | |
/// Provides a set of static methods for querying objects that implement System.Collections.Generic.IEnumerable<T>. | |
/// </summary> | |
public static class Extensions |
NewerOlder