Skip to content

Instantly share code, notes, and snippets.

View Meligy's full-sized avatar

Meligy Meligy

View GitHub Profile
@Meligy
Meligy / random
Created March 19, 2011 15:18
How to eager load Child Collections (Ex: Blog.Post.Comments) Directly Using QueryOver In NHibernate 3.1
session.QueryOver<Blog>()
.Fetch(b => b.Posts).Eager // If you don't add this, the following will not work
.Fetch(b => b.Posts.First().Comments).Eager // The trick here is using ".First()" after the collection
.List();
@Meligy
Meligy / Newtonsoft_Json_Sample.cs
Created May 10, 2011 06:14
Seeing what capabilities JSON.NET has in working with slightly complex structures
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Newtonsoft.Json;
namespace SampleJson
{
class Program
{
@Meligy
Meligy / SetConverter.cs
Created May 10, 2011 12:38
A simple way to resolve ISet<> interface from JSon string as HashSet<> object
namespace SampleJson
{
using Newtonsoft.Json.Converters;
using System.Collections.Generic;
internal class SetConverter<T> : CustomCreationConverter<ISet<T>>
{
public override ISet<T> Create(Type objectType)
{
return new HashSet<T>();
@Meligy
Meligy / app-default-button.js
Last active December 16, 2015 08:28
Sample directive to set default button click using Angular JS in ASP.NET webforms app
var app = angular.module("app", []);
app = app.directive('appDefaultButton', function () {
return function (scope, element, attr, ctrl) {
// This is all standard directive code copied from ng-sanitize
// The point of it is store & track
// if passed value was changed & re-run
element.addClass('app-default-button')
if((Get-WebConfiguration -Filter /system.webServer/isapiFilters/filter |
Where-Object -Property path -EQ $isapiDllPath) `
-eq $null) {
Add-WebConfiguration -Filter /system.webServer/isapiFilters `
-Value @{
name = $isapiName;
path = $isapiDllPath;
preCondition = $preConditionIfAny
} `
@Meligy
Meligy / Path.md
Last active December 21, 2015 23:49
This is where your pinned taskbar icons live. Helpful for creating icons with shortcuts Via http://superuser.com/questions/420085/how-can-i-pin-a-program-to-the-windows-7-taskbar-with-parameters

Batch file or simply pasting in start menu/screen:

%userprofile%\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar

Powershell:

"$env:USERPROFILE\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar"

@Meligy
Meligy / osx-setup.md
Last active August 29, 2015 14:12 — forked from zenorocha/.hyper.js

Setup Mac OS X

I'm in a hospital in Spain and my MacBook was stolen.

Hospital Commit

Now I bought a new one and need to configure it. I have an external hard drive that backup everything using Time Machine, but I don't want all the crap I had in the old one.

1. Run Software Update

@Meligy
Meligy / Instructions.md
Created July 24, 2016 15:00
Using jQuery with Angular 2 CLI Webpack Version – With No TypeScript Conflict

I wrote a post yesterday that talked about: [Using Webpack with Angular CLI directly from official Github source][post] [post]: https://www.gurustop.net/blog/2016/07/24/angular2-angularcli-load-cli-from-git-github-master-webpack

The post seemed to get a bit of traction on twitter, and among other feedback, I got an interesting question in a direct message:

Hi Meligy, Have you tried importing jQuery in Angular-CLI webpack branch project anytime??

Well, turns out I didn't. I expected it to be just a require(...) / import ... line away. With Webpack, you often don't need much more than that.