Skip to content

Instantly share code, notes, and snippets.

@vmysla
vmysla / gist:5316941
Last active December 15, 2015 20:09
// Subject: Complex object with set of properties and inner objectss
// Mission: Describe fluent DSL to define scheme and delegate action execution
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Text.RegularExpressions;
// Subject: Method that should replace first instance of Keyword with link in set set of strings
// Mission: Improve method performance
//
//
// *** Usage ***
// public string WordsToReplaceInThreadOnFirstInstance = new Dictionary<string,string>{...};
// public string Message = "...";
// public string RegExPatternWordNotInsideATag = @"\b{0}\b(?![^<]*?<[^>\/]*\/\s*a\s*>)";
// Message = StringExtensions.Replace(Message, WordsToReplaceInThreadOnFirstInstance, true, StringExtensions.RegExPatternWordNotInsideATag);
Server Error in '/' Application.
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
@vmysla
vmysla / index.html
Last active December 16, 2015 22:29
PoC of blocking synchronized method call - "await". it works same as window.alert(string) dialog which stop script's execution. buggy, not fancy, was born in firebug.
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script>
function async(T, method){
console.log('before async create');
return function () { return method.apply(T); };
console.log('after async create');
};
HTTP Status 500 - java.lang.IllegalStateException: <pingQuery> not configured (consider registering PingRequestHandler with the name '/admin/ping' instead) org.apache.jasper.JasperException: java.lang.IllegalStateException: <pingQuery> not configured (consider registering PingRequestHandler with the name '/admin/ping' instead) at org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:549) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:465) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334) at javax.servlet.http.HttpServlet.service(HttpServlet.java:722) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684) at org.apache.catalina.cor
System.NotSupportedException: Cannot serialize interface System.Collections.Generic.IEnumerable`1[[JA.Question.QuestionLink, library, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].
at System.Xml.Serialization.TypeScope.GetTypeDesc(Type type, MemberInfo source, Boolean directReference, Boolean throwOnError)
at System.Xml.Serialization.ModelScope.GetTypeModel(Type type, Boolean directReference)
at System.Xml.Serialization.XmlSerializer..ctor(Type type, String defaultNamespace)
at Pearl.Core.Serialization.ContentSerializer.deSerializeObject[T](String serialized, Boolean xmlSerialization, Boolean logError) in c:\ja-legacy\Projects\Pearl\Pearl.Core\Serialization\ContentSerializer.cs:line 168
@vmysla
vmysla / gist:9997052
Created April 5, 2014 19:40
optimizley beautified
var a = document.head || document.getElementsByTagName("head")[0] || document.documentElement,
b = document.createElement("script");
b.type = "text/javascript";
b.async = !0;
b.src = "//cdn3.optimizely.com/js/geo.js";
a.insertBefore(b, a.firstChild);
optimizelyCode = function () {
var DATA = {
"log_host": "log.optimizely.com",
@vmysla
vmysla / gist:9999238
Created April 5, 2014 23:05
optimizley beautified (no $)
optimizelyCode = function () {
var DATA = {
"log_host": "log.optimizely.com",
"goal_expressions": {
"791962898": ["^button\\/click\\/get\\_an\\_answer$"],
"789281734": ["^engagement$"]
},
"experiments": {
"792022794": {
"name": "JA14745: [LEAP] Legal SIP page with new JA styles",
@vmysla
vmysla / gist:10027984
Created April 7, 2014 18:37
Optimizely - execute callback after tracked event was successfully received by Optimizely's server
var expectedEvent = 'button/click/get_an_answer';
var callback = function(){ alert(expectedEvent); };
var hasExpectedEvent = false;
var areAllEventsSent = true;
var log = console.log;
console.log = function(){
log.apply(console, arguments);
@vmysla
vmysla / gist:11a61299f1c88b70be75
Created May 21, 2014 09:15
Listener for Optimizely's Event Tracking event
var expectedEvent = 'button/click/get_an_answer';
var callback = function(){ alert(expectedEvent); };
var hasExpectedEvent = false;
var areAllEventsSent = true;
var log = console.log;
console.log = function(){
log.apply(console, arguments);