Skip to content

Instantly share code, notes, and snippets.

View jrgcubano's full-sized avatar

Jorge Rodríguez Galán jrgcubano

View GitHub Profile
@jrgcubano
jrgcubano / XmlParser.cs
Created April 22, 2016 10:24 — forked from 7shi/XmlParser.cs
XmlParser (C#)
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
public class XmlParser : IDisposable
{
public TextReader Stream { get; private set; }
public string Text { get; private set; }
@jrgcubano
jrgcubano / gist:65fc75a00539b522a29bbd6a4bcf739a
Created April 25, 2016 23:19 — forked from d6veteran/gist:984122
Multiple Custom Markers for Google Maps
<script type="text/javascript">
function initialize() {
var latlng = new google.maps.LatLng(36.14, -115.14);
var myLatlng = new google.maps.LatLng(36.14,-115.14);
var myOptions = {
zoom: 12,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map_canvas"),
@jrgcubano
jrgcubano / ionic2-button-loader-and-text
Created May 3, 2016 14:08 — forked from bostjanpisler/ionic2-button-loader-and-text
Ionic 2 directive loader which is placed inside button instead of text
// Usage
// Only tested with normal size button, will update if required
<my-loader [loading]="loading" defaultText="LOGIN"></my-loader>
// loader.ts
import { Component, Input } from 'angular2/core';
@Component({
selector: 'my-loader',
template: `
#add 'node_modules' to .gitignore file
git rm -r --cached node_modules
git commit -m 'Remove the now ignored directory node_modules'
git push origin master
@jrgcubano
jrgcubano / gist:2798a0501b009c5a4a2d66d678b78262
Created May 6, 2016 14:23 — forked from danielmoore/gist:1182831
double click mouse move in RX and WPF
var target = new Border{ Background = Brushes.SteelBlue, Width = 200, Height = 200 };
var win = new Window{ Content = target };
var mouseDown = Observable.FromEventPattern<MouseEventArgs>(target, "MouseLeftButtonDown");
var mouseMove = Observable.FromEventPattern<MouseEventArgs>(target, "MouseMove");
var mouseUp = Observable.FromEventPattern<MouseEventArgs>(target, "MouseLeftButtonUp");
// dragEvents is IObservable<IObservable<EventPattern<MouseMoveEvent>>>
// The first dimmension represents the sequence of discrete drag "sessions"
// The second dimmension represents the sequence of moves within that drag
@jrgcubano
jrgcubano / Deploy.ps1
Created May 11, 2016 11:03 — forked from andrewabest/Deploy.ps1
An example Octopus deployment script for WPF ClickOnce applications.
Write-Host 'Copy the package payload over to the clickonce web application location'
$source = ".\"
$dest = "C:\Octopus\Applications\${OctopusEnvironmentName}\NextGen.ClickOnce\${OctopusPackageVersion}\Package"
$exclude = @('*.pdb','mage.exe', '*.ps1', '*Build*', '*.pfx')
$appManifestName = "${OctopusPackageName}.exe.manifest"
$appManifestPath = Join-Path $dest $appManifestName
$deployManifestPath = Join-Path $dest "${OctopusPackageName}.application"
@jrgcubano
jrgcubano / observable-request-service-spec.ts
Created May 15, 2016 20:15 — forked from vladimir-ivanov/observable-request-service-spec.ts
example of angular2 spec with MockBackend for the Http object - angular2 test
///<reference path="../../../typings/angularjs/angular-mocks.d.ts"/>
import {ObservableRequestService} from '../../../src/core/observable-request-service.ts';
import {
Http,
ConnectionBackend,
BaseRequestOptions,
MockBackend,
ResponseOptions,
Response
} from 'angular2/http';
@jrgcubano
jrgcubano / Extensions.cs
Created May 19, 2016 09:56 — forked from robfe/Extensions.cs
ObservePropertyChanged extension method (INotifyPropertyChanged.Property => IObservable)
public static class Extensions
{
public static IObservable<TProperty> ObservePropertyChanged<TNotifier, TProperty>(
this TNotifier notifier,
Expression<Func<TNotifier, TProperty>> propertyAccessor,
bool startWithCurrent = false)
where TNotifier : INotifyPropertyChanged
{
// Parse the expression to find the correct property name.
@jrgcubano
jrgcubano / ApiClient.cs
Created June 7, 2016 09:27 — forked from craigrbruce/ApiClient.cs
An example REST API client for C#
/*
Call the api client like this:
var client = new ApiClient<SEnvelope>("https://baseurl.com/api/v1");
//you would overload and add an auth_token param here
client.GetDtoAsync("envelopes", "object_id", (response) => //callback
{
this.SEnvelope = response.Data;//should be an envelope from the server
});
select * from Source_Table;
select * from
( select
person,
country,
'country' + cast(rank()
over (partition by person order by id)
as varchar(10))
as countryrank