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
/*jslint plusplus: true, vars: true, indent: 2 */ | |
/* | |
convertPointFromPageToNode(element, event.pageX, event.pageY) -> {x, y} | |
returns coordinate in element's local coordinate system (works properly with css transforms without perspective projection) | |
convertPointFromNodeToPage(element, offsetX, offsetY) -> {x, y} | |
returns coordinate in window's coordinate system (works properly with css transforms without perspective projection) | |
*/ |
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
node_modules/ |
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
// Lack of tail call optimization in JS | |
var sum = function(x, y) { | |
return y > 0 ? sum(x + 1, y - 1) : | |
y < 0 ? sum(x - 1, y + 1) : | |
x | |
} | |
sum(20, 100000) // => RangeError: Maximum call stack size exceeded | |
// Using workaround |
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.ComponentModel; | |
using System.Runtime.InteropServices; | |
using System.Text; | |
using Microsoft.Win32.SafeHandles; | |
public static class CredentialManager | |
{ | |
public static Credential ReadCredential(string applicationName) |
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.IO; | |
using System.Security; | |
using System.Security.Cryptography; | |
using System.Runtime.InteropServices; | |
using System.Text; | |
namespace CSEncryptDecrypt | |
{ | |
class Class1 |
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 void EncrpytFiles(IList<Documents> documentsList) | |
{ | |
foreach (var document in documentsList) | |
{ | |
TripleDESCryptoServiceProvider tdes = new TripleDESCryptoServiceProvider(); | |
tdes.Padding = (PaddingMode.ISO10126); | |
tdes.Mode = CipherMode.CBC; | |
tdes.GenerateIV(); | |
tdes.GenerateKey(); | |
tdes.CreateEncryptor(); |
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
//Some old math stuff I wrote when in Trig class | |
using System; | |
using System.IO; | |
public class Geometry | |
{ | |
//-----Area of a circle A= pi^2-------------------------------------------- | |
public static double Area_Circle(double radius) | |
{ | |
double area = 2*(Math.PI*(radius*radius)); |
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 class IQueryableExtensions | |
{ | |
private static readonly TypeInfo QueryCompilerTypeInfo = typeof(QueryCompiler).GetTypeInfo(); | |
private static readonly FieldInfo QueryCompilerField = typeof(EntityQueryProvider).GetTypeInfo().DeclaredFields.First(x => x.Name == "_queryCompiler"); | |
private static readonly PropertyInfo NodeTypeProviderField = QueryCompilerTypeInfo.DeclaredProperties.Single(x => x.Name == "NodeTypeProvider"); | |
private static readonly MethodInfo CreateQueryParserMethod = QueryCompilerTypeInfo.DeclaredMethods.First(x => x.Name == "CreateQueryParser"); |
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
/* jQuery ui-datepicker extension */ | |
/** | |
* | |
* https://gist.github.com/Artemeey/8bacd37964a8069a2eeee8c9b0bd2e44/ | |
* | |
* Version: 1.0 (15.06.2016) | |
* Requires: jQuery v1.8+ | |
* Requires: jQuery-UI v1.10+ | |
* |
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 Sortable extends React.Component { | |
componentDidMount() { | |
// Every React component has a function that exposes the | |
// underlying DOM node that it is wrapping. We can use that | |
// DOM node, pass it to jQuery and initialize the plugin. | |
// You'll find that many jQuery plugins follow this same pattern | |
// and you'll be able to pass the component DOM node to jQuery | |
// and call the plugin function. |
OlderNewer