Skip to content

Instantly share code, notes, and snippets.

Param(
[string]$sourceRootPath
)
$paths=New-Object System.Collections.Generic.List[System.Object]
$paths.Add("C:\Program Files\nodejs")
$paths.Add("${HOME}\.dotnet\NuGetFallbackFolder")
$paths.Add("${HOME}\.nuget\packages")
$paths.Add("${HOME}\AppData\Local\Yarn")
$paths.Add("${HOME}\AppData\Roaming\npm")
@sciolist
sciolist / README.md
Created October 16, 2015 06:52
Convert Viewstates to Json, for debugging.

ViewStateToJsonExporter

Hopefully you're free from Webforms and ViewStates by now.. But sometimes bad things happen to good people, and you need to find out why the viewstate of a decade old site is 5mb large. Inspecting the viewstate is all manners of not fun, so this little class could help!

Usage

To use the class, you'll need to overload the 'SavePageStateToPersistenceMedium' of a WebForms page, inside that you can call the Save-function of ViewStateToJsonExporter, and you'll get a nice big json dump!

@sciolist
sciolist / NPocoFaceting.cs
Created September 18, 2015 17:39
Awful faceting with NPoco and SQL Server 2012
using NPoco;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Xml.Linq;
namespace NPocoFaceting
{
public class FacetBuilder
{
@sciolist
sciolist / WKWebView+HideInputAccessoryView.h
Created July 10, 2015 10:26
WKWebView+HideInputAccessoryView
#include <WebKit/WebKit.h>
@interface WKWebView (HideInputAccessoryView)
- (void) setAccessoryViewEnabled:(BOOL)on;
@end
@sciolist
sciolist / CorsProxy.swift
Created July 8, 2015 08:07
GCDWebServer Cors proxy
import GCDWebServer
class CorsProxy {
init(webserver : GCDWebServer!, urlPrefix: String) {
var prefix =
(urlPrefix.hasPrefix("/") ? "" : "/")
+ urlPrefix
+ (urlPrefix.hasSuffix("/") ? "" : "/")
let pattern = "^" + NSRegularExpression.escapedPatternForString(prefix) + ".*"
@sciolist
sciolist / alert.js
Created September 11, 2014 21:32
jQuery.feature
(function ($, window, undefined) {
"use strict";
$.feature('js-alert', function (el, value) {
$(el).click(function () { alert(value); });
});
})(jQuery, window);
@sciolist
sciolist / pack.js
Created October 9, 2013 23:36
awful browserify transform to pack in client config.
function packConfiguration() {
var config = require('../../client-config.js');
var clientConfig = 'module.exports=exports=(' + JSON.stringify(config) + ');\n';
var clientTransformFile = require.resolve('../../../../public/media/js/config.js');
return function clientConfigTransform(file) {
if(file !== clientTransformFile) return through();
var data = '';
return through(
function(inp) { data += inp; },
@sciolist
sciolist / package.json
Last active December 23, 2015 02:49
simple postgres one-way migration process
{
"name": "pomp",
"version": "0.1.0",
"bin": {
"pomp": "./pomp.sh"
}
}
@sciolist
sciolist / schema.xml
Created September 2, 2013 20:55
basic solr config
<?xml version="1.0" encoding="UTF-8" ?>
<schema name="example" version="1.5">
<uniqueKey>id</uniqueKey>
<fields>
<field name="id" type="string" indexed="true" stored="true" required="true" multiValued="false" />
<field name="client" type="string" indexed="true" stored="true" required="true" multiValued="false" />
<field name="_version_" type="long" indexed="true" stored="true"/>
<dynamicField name="*_i" type="tint" indexed="true" stored="true" multiValued="false" />
<dynamicField name="*_txt" type="text_sv" indexed="true" stored="true" multiValued="false" />
var index = new Index([
{ name: 'Moped', flags: ['slow', 'vehicle', 'red'] },
{ name: 'Car', flags: ['fast', 'vehicle', 'blue'] }
]);
index.facet('flags', function(m) { return m.flags });
var query = new BitField(index.items.length, true);
query.and(index.facets.flags.fast);
console.log(index.collect(query)); // [ { name: 'Car' } ... ]
query.or(index.facets.flags.red);