Skip to content

Instantly share code, notes, and snippets.

View warpech's full-sized avatar
🤹‍♂️
Code sweet code

Marcin Warpechowski warpech

🤹‍♂️
Code sweet code
View GitHub Profile
@warpech
warpech / jquery.xdomain.js
Created December 15, 2011 16:10 — forked from mathieucarbou/jquery.xdomain.js
jQuery CORS Plugin - transparently add CORS support for IE8+ in jQuery using XDomainRequest. Support cookies.
(function($) {
var urlParseRE = /^(((([^:\/#\?]+:)?(?:\/\/((?:(([^:@\/#\?]+)(?:\:([^:@\/#\?]+))?)@)?(([^:\/#\?]+)(?:\:([0-9]+))?))?)?)?((\/?(?:[^\/\?#]+\/+)*)([^\?#]*)))?(\?[^#]+)?)(#.*)?/;
function parseUrl(url) {
if (typeof url === "object") {
return url;
}
var u = url || "", matches = urlParseRE.exec(url), results;
if (matches) {
results = {
@warpech
warpech / jquery.handsontable.js
Created June 15, 2012 10:34
Fix for Korean characters?
/**
* Handsontable is a simple jQuery plugin for editable tables with basic copy-paste compatibility with Excel and Google Docs
*
* Copyright 2012, Marcin Warpechowski
* Licensed under the MIT license.
* http://warpech.github.com/jquery-handsontable/
*/
/*jslint white: true, browser: true, plusplus: true, indent: 4, maxerr: 50 */
(function ($) {
"use strict";
@warpech
warpech / gist:5973876
Last active December 19, 2015 15:08
Excel copy paste tests
//1. Plain simple text (total 2 rows, 2 columns)
A0 B0
A1 B1
//2. Fully quoted text in first cell (total 2 rows, 2 columns)
"This is a fully quoted text in the A0 column" B0
A1 B1
//3. Partially quoted text in first cell (total 2 rows, 2 columns)
This is a "partially" quoted text in the A0 column B0
@warpech
warpech / no-threads.js
Last active December 21, 2015 01:38
current view model
//Master.json
//-----------
{
LoggedInUser: "",
ApplicationPage: {
}
}
//PMail.json (ApplicationPage)
//Master.json
//-----------
{
LoggedInUser: "",
ApplicationPage: {
}
}
//PMail.json (ApplicationPage)
@warpech
warpech / gist:6279679
Last active December 21, 2015 08:39
Current and expected response
//Request
//http://81.236.246.27:8080/mailboxes/Inbox
//Accept:application/json-patch+json
//Current response
[{"op":"add","path":"/Mails","value":{"From":{"Address":""},"Subject":"Hi there","Uri":"/mails/123"}},
{"op":"add","path":"/Mails","value":{"From":{"Address":""},"Subject":"Buy diet pills","Uri":"/mails/124"}},
{"op":"add","path":"/Mails","value":{"From":{"Address":""},"Subject":"Business opportunity","Uri":"/mails/125"}},
{"op":"replace","path":"/Mails/0/Subject","value":"Hi there"},
Handsontable.PluginHooks.add('afterRenderer', function(TD, row, col, prop, value, cellProperties) {
if (value === null) {
TD.style.fontStyle = 'italic';
TD.appendChild(document.createTextNode('NULL'));
}
});
@warpech
warpech / json-patch-duplex.js
Last active December 28, 2015 09:49
JSON Patch duplex - ignore locally added properties
// json-patch-duplex.js 0.3.6 with enhancement to ignore locally added properties
// (c) 2013 Joachim Wester
// MIT license
var jsonpatch;
(function (jsonpatch) {
var objOps = {
add: function (obj, key) {
obj[key] = this.value;
return true;
},
System.NullReferenceException was unhandled by user code
HResult=-2147467261
Message=Object reference not set to an instance of an object.
Source=Starcounter.Node
StackTrace:
at Starcounter.X.CheckLocalCache(String uri, Object userObject, Action`2 userDelegate, Response& resp)
at Starcounter.X.GET[T](String uri, Int32 receiveTimeoutMs)
at Page.AsMimeType(MimeType type) in c:\Sites\PMail\Server\Page.json.cs:line 10
at Starcounter.Internal.JsonMimeConverter.Convert(Request request, Object before, MimeType mimeType, MimeType& resultingMimeType)
at Starcounter.Json.AsMimeType(MimeType mimeType, MimeType& resultingMimeType, Request request)
Server responded with error 500 InternalServerError
Cannot access a disposed object.
at Starcounter.Transaction.SetCurrent(Transaction value)
at Starcounter.Internal.JsonPatch.JsonPatch.EvaluatePatches(Json rootApp, Byte[] body)
at Starcounter.Internal.SqlRestHandler.b__12(Session session, Request request)
at lambda_method(Closure , Request , IntPtr , IntPtr )
at Starcounter.Internal.HandlersManagement.RunDelegate(Request r, Response& resource)
at Starcounter.Internal.Web.AppRestServer.HandleRequest(Request request)