Skip to content

Instantly share code, notes, and snippets.

🤹‍♂
Code sweet code

Marcin Warpechowski warpech

🤹‍♂
Code sweet code
Block or report user

Report or block warpech

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@warpech
warpech / jquery.xdomain.js
Created Dec 15, 2011 — forked from mathieucarbou/jquery.xdomain.js
jQuery CORS Plugin - transparently add CORS support for IE8+ in jQuery using XDomainRequest. Support cookies.
View jquery.xdomain.js
(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 Jun 15, 2012
Fix for Korean characters?
View jquery.handsontable.js
/**
* 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 Dec 19, 2015
Excel copy paste tests
View gist:5973876
//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 Dec 21, 2015
current view model
View no-threads.js
//Master.json
//-----------
{
LoggedInUser: "",
ApplicationPage: {
}
}
//PMail.json (ApplicationPage)
View contacts.js
//Master.json
//-----------
{
LoggedInUser: "",
ApplicationPage: {
}
}
//PMail.json (ApplicationPage)
@warpech
warpech / gist:6279679
Last active Dec 21, 2015
Current and expected response
View gist:6279679
//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"},
View scNullCellsPlugin.js
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 Dec 28, 2015
JSON Patch duplex - ignore locally added properties
View json-patch-duplex.js
// 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;
},
View gist:8404567
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)
View gist:8416036
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)
You can’t perform that action at this time.