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> | |
/// Resultset to be JSON stringified and set back to client. | |
/// </summary> | |
[Serializable] | |
[SuppressMessage("ReSharper", "InconsistentNaming")] | |
public class DataTableResultSet | |
{ | |
/// <summary>Array of records. Each element of the array is itself an array of columns</summary> | |
public List<List<string>> data = new List<List<string>>(); |
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 BloggingContext : DbContext | |
{ | |
public DbSet<Blog> Blogs { get; set; } | |
public DbSet<Post> Posts { get; set; } | |
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) => | |
optionsBuilder | |
//Log parameter values | |
.EnableSensitiveDataLogging() | |
.UseSqlCe(@"Data Source=Blogging.sdf"); |
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
<script> | |
/* to show modal via jquery clock event bound to id="modal_button_id" a/button/etc */ | |
$(document).ready(function() { | |
$('#modal_button_id').click(function (event) { | |
$('#myModal').modal('show') | |
}); | |
</script> | |
<div class="modal hide fade" id="modalID"> | |
<div class="modal-header"> |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8" /> | |
<title>Shadows Test</title> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> | |
<style> | |
* { |
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
<!doctype html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Navigation Test</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"> | |
<script> | |
var isTouchDevice = 'ontouchstart' in document.documentElement; | |
window.onload = function () { | |
var where = document.getElementById('where'); |
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
/* | |
For this version we'll add a register method to add a user to the database using proper | |
password encryption. It also demonstrates how to add and use a method on a schema. | |
Reference: https://www.sitepoint.com/user-authentication-mean-stack | |
*/ | |
const mongoose = require('mongoose') | |
const crypto = require('crypto') | |
//const findOrCreate = require('mongoose-findorcreate') | |
//Set up ES6 Promises |
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
var els = document.getElementsByClassName('current-class-name'); | |
removeClass(els, 'current-class-name'); | |
addClass(els, 'new-class-name'); | |
var el = document.getElementById('current-class-name'); | |
removeClass([el], 'current-class-name'); | |
addClass([el], 'new-class-name'); | |
function addClass(elements, className) { | |
for (var i = 0; i < elements.length; i++) { |
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
// Shamelessly stolen and adapted from http://stackoverflow.com/questions/506096/comparing-object-properties-in-c | |
public static class Comparisons | |
{ | |
public static bool PublicInstancePropertiesEqual<T>(this T self, T to, params string[] ignore) where T : class | |
{ | |
if (self != null && to != null) | |
{ | |
var type = typeof(T); | |
foreach (var propertyName in type.GetProperties(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance).Select(pi => pi.Name).Except(ignore)) | |
{ |
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
string ivAsBase64; | |
string encryptedTextAsBase64; | |
string keyAsBase64; | |
using (AesCryptoServiceProvider aes = new AesCryptoServiceProvider()) | |
{ | |
// Store the IV (they can be stored if you don't re-use a key) | |
aes.GenerateIV(); | |
byte[] iv = aes.IV; | |
ivAsBase64 = Convert.ToBase64String(iv); |
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 slugify(text) | |
{ | |
return text.toString().toLowerCase() | |
.replace(/\s+/g, '-') // Replace spaces with - | |
.replace(/[^\w\-]+/g, '') // Remove all non-word chars | |
.replace(/\-\-+/g, '-') // Replace multiple - with single - | |
.replace(/^-+/, '') // Trim - from start of text | |
.replace(/-+$/, ''); // Trim - from end of text | |
} |
NewerOlder