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
# How to make lodash available via "_" on console | |
var el = document.createElement('script'); | |
el.src = 'https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.21/lodash.min.js'; | |
document.getElementsByTagName('head')[0].appendChild(el); | |
# Use _.VERSION or any other function to verify that it worked |
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
/* pqueue.h | |
Header file for pqueue implementation | |
by: Jonathan Haywood | |
*/ | |
#define PQUEUESIZE 1000 | |
#define PARENT(i) ((i-1)/2) | |
#define LEFT(i) ((2*i+1)) |
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
-- Search Tables | |
SELECT c.name AS 'ColumnName' | |
,t.name AS 'TableName' | |
FROM sys.columns c | |
JOIN sys.tables t ON c.object_id = t.object_id | |
WHERE c.name LIKE '%MyName%' | |
ORDER BY TableName | |
,ColumnName; | |
-- Search Tables and Views |
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
public static string[] SplitCsv(string input) | |
{ | |
Regex csvSplit = new Regex("(?:^|,)(\"(?:[^\"]+|\"\")*\"|[^,]*)", RegexOptions.Compiled); | |
List<string> list = new List<string>(); | |
string curr = null; | |
foreach (Match match in csvSplit.Matches(input)) | |
{ | |
curr = match.Value; | |
if (0 == curr.Length) | |
{ |
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
(function (factory) { | |
if (typeof define === 'function' && define.amd) { | |
define(factory); | |
} else if (typeof exports === 'object') { | |
module.exports = factory(); | |
} else { | |
// globally available via window | |
var _OldComponent = window.MyComponent; | |
var api = window.MyComponent = factory(); | |
api.noConflict = function () { |
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
public class PhpArrayConverter | |
{ | |
//types: | |
// N = null | |
// s = string | |
// i = int | |
// d = double | |
// a = array (hashtable) | |
private readonly NumberFormatInfo numberFormatInfo; |
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
public class Aes256EncryptionService | |
{ | |
public byte[] GenerateKey() | |
{ | |
using (var aes = CreateAes256Algorithm()) | |
{ | |
aes.GenerateKey(); | |
return aes.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
using System; | |
using System.CodeDom.Compiler; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Linq; | |
using System.Reflection; | |
namespace SourceCompiler | |
{ | |
/// <summary> |
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
/// <summary> | |
/// Based on https://gist.github.com/aliostad/2519771 | |
/// </summary> | |
public class BinaryMediaTypeFormatter : MediaTypeFormatter | |
{ | |
private static readonly Type SupportedType = typeof(byte[]); | |
private bool isAsync; | |
public BinaryMediaTypeFormatter() |
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
private void ShowWaitDialog(Action codeToRun) | |
{ | |
ManualResetEvent dialogLoadedFlag = new ManualResetEvent(false); | |
// open the dialog on a new thread so that the dialog window gets | |
// drawn. otherwise our long running code will run and the dialog | |
// window never renders. | |
(new Thread(() => | |
{ | |
Form waitDialog = new Form() |