Skip to content

Instantly share code, notes, and snippets.

@weedkiller
weedkiller / RandomClassesDivs.js
Created January 15, 2017 22:14 — forked from charleslouis/RandomClassesDivs.js
Javascript - append div in a container with random classes and positions
(function RandomClassesDivs(){
// declare classes we want to apply
var bubbleColors = ['bubble_color_1', 'bubble_color_2', 'bubble_color_3', 'bubble_color_4', 'bubble_color_5', 'bubble_color_6'];
var bubbleSizes = ['bubble_1', 'bubble_2', 'bubble_3', 'bubble_4', 'bubble_5'];
//find the highest key of the classes arrays
var nbrSizes = (bubbleSizes.length) - 1,
nbrColors = (bubbleColors.length) - 1;
@weedkiller
weedkiller / tableToArray.js
Created January 21, 2017 19:40 — forked from westc/tableToArray.js
Convert a table to a 2D array.
function tableToArray(tbl, opt_cellValueGetter) {
opt_cellValueGetter = opt_cellValueGetter || function(td) { return td.textContent || td.innerText; };
var twoD = [];
for (var rowCount = tbl.rows.length, rowIndex = 0; rowIndex < rowCount; rowIndex++) {
twoD.push([]);
}
for (var rowIndex = 0, tr; rowIndex < rowCount; rowIndex++) {
var tr = tbl.rows[rowIndex];
for (var colIndex = 0, colCount = tr.cells.length, offset = 0; colIndex < colCount; colIndex++) {
var td = tr.cells[colIndex], text = opt_cellValueGetter(td, colIndex, rowIndex, tbl);
var data = '\
<svg xmlns="http://www.w3.org/2000/svg" height="100" width="100">\
<foreignObject width="100%" height="100%">\
<div xmlns="http://www.w3.org/1999/xhtml" style="font-size: 1px;">\
<div style="\
height: 100em;\
width: 100em;\
background: hsl(200,100%,50%);\
border-radius: 50em;\
box-sizing: border-box;\
@weedkiller
weedkiller / limitEval.js
Created January 21, 2017 19:44 — forked from westc/limitEval.js
Use web workers to limit the amount of time that an eval can run.
function limitEval(code, fnOnStop, opt_timeoutInMS) {
var id = Math.random() + 1,
blob = new Blob(
['onmessage=function(a){a=a.data;postMessage({i:a.i+1});postMessage({r:eval.call(this,a.c),i:a.i})};'],
{ type:'text/javascript' }
),
myWorker = new Worker(URL.createObjectURL(blob));
function onDone() {
URL.revokeObjectURL(blob);
@weedkiller
weedkiller / sample.cs
Created January 25, 2017 22:03 — forked from willerup/sample.cs
intuit1
public sealed class IntuitAuthenticationOptions : OpenIDAuthenticationOptions
{
public const string FirstName = "intuit.firstname";
public const string LastName = "intuit.lastname";
public const string Email = "intuit.email";
public IntuitAuthenticationOptions()
{
ProviderDiscoveryUri = "https://openid.intuit.com/openid/xrds";
Caption = "Intuit";
@weedkiller
weedkiller / start.cs
Created January 25, 2017 22:03 — forked from willerup/start.cs
intuit3
public void ConfigureAuth(IAppBuilder app)
{
...
app.UseIntuitAuthentication();
}
@weedkiller
weedkiller / Export-ExcelCSV.ps1
Created January 27, 2017 08:23
Export-ExcelCSV.ps1 #powershell #excel
# Author: Miodrag Milic <[email protected]>
# Last Change: 12-Feb-2016.
param(
# Path to Excel file
[string] $Path
)
if (!(Test-Path $Path)) { throw Path not found: $Path }
ps excel -ea 0| kill
@weedkiller
weedkiller / IdentityConsoleSeeding.cs
Created February 2, 2017 04:13 — forked from rustd/IdentityConsoleSeeding.cs
ASP.NET Identity Seed a database in a console application
using Microsoft.AspNet.Identity.EntityFramework;
using Microsoft.AspNet.Identity;
using System;
using System.Data.Entity;
using System.Threading.Tasks;
namespace SeedDb
{
// html
<div id="feedback">
<a href="/feedback_url/">feedback</a>
</div>
// css
#feedback {
height: 104px;
@weedkiller
weedkiller / Ember in ASP.NET MVC.md
Created February 4, 2017 07:01 — forked from RyannosaurusRex/Ember in ASP.NET MVC.md
Adding an EmberJS app to an ASP.NET MVC app

How to set up an Ember app inside of an ASP.NET MVC app.

I love Ember. It helps me build fantastic UIs, but security isn't super straightforward and I suck at it. I love ASP.NET MVC. It help me build secure applications and solid APIs, but for some apps I need a great responsive UI with great interaction.

Together, these two technologies can be used together to create really amazing apps (and really quickly, too). So this guide is to show you how to set them up together.

Note: This article assumes you have created a stock new ASP.NET project within Visual Studio and included MVC and WebAPI options. It also assumes you have EMBER CLI installed and have run ember new my-ember-app into a directory in the root of your ASP.NET MVC project.