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 / git_newrepo
Created June 19, 2018 15:12 — forked from c0ldlimit/git_newrepo
Git: Push a new or existing repo to Github
# Create a new repository on the command line
touch README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/c0ldlimit/vimcolors.git
git push -u origin master
# Push an existing repository from the command line
@jrgcubano
jrgcubano / _readme.md
Created April 10, 2018 11:44 — forked from robdmoore/_readme.md
NodeJS Script to automate deployment of Cordova/PhoneGap application using PhoneGapBuild

pgb-wrapper.js is a generic wrapper module around the phonegap-build-api NodeJS package to add promise support and some helpful functions to make it easier to create a build script.

pgb.example.js is one example of such a build script, but you might decide to do it differently.

You can execute pgb.example.js by:

node pgb.example.js --appId {PGB_APP_ID} --apiKey {PGB_API_KEY} --zipFile {path/to/deployment_file.zip} --iosOverTheAirKey {NAME_OF_IOS_OVER_THE_AIR_KEY_IN_PGB} --iosOverTheAirKeyPassword {PASSWORD_OF_IOS_OVER_THE_AIR_KEY_IN_PGB} --iosKey {NAME_OF_IOS_PRODUCTION_KEY_IN_PGB} --iosKeyPassword {PASSWORD_OF_IOS_PRODUCTION_KEY_IN_PGB} --androidKey {NAME_OF_ANDROID_PRODUCTION_KEY_IN_PGB} --androidKeyPassword {PASSWORD_OF_ANDROID_PRODUCTION_KEY_IN_PGB}

The following node packages need to be installed for it all to work:

  • phonegap-build-api
@jrgcubano
jrgcubano / TaskHeartBeatExample.cs
Last active April 6, 2018 08:26
Task HeartBeats Extensions
private static async Task PerformHeartbeat(CancellationToken cancellationToken) {
Console.WriteLine("Starting heartbeat {0}", ++_heartbeatCount);
await Task.Delay(1000, cancellationToken);
Console.WriteLine("Finishing heartbeat {0}", _heartbeatCount);
}
The PerformHeartbeat could be replaced with an async call like RenewLockAsync so that you wouldn't
have to waste thread time using a blocking call like RenewLock that the Action approach would require.
@jrgcubano
jrgcubano / store.js
Created March 6, 2018 11:33 — forked from chris-burgin/store.js
Object Literal Redux Store Reducer
// ****************
// Reducer Imports
// ****************
import {
// users
DELETEUSER,
UPDATEUSER,
ADDUSER,
ADDUSERS
} from "./reducers/index.js"
@jrgcubano
jrgcubano / docker-clean.ps1
Created February 7, 2018 14:18 — forked from bradwilson/docker-clean.ps1
Docker Cleanup
(& docker images --all --quiet --filter 'dangling=true') | Foreach-Object {
& docker rmi $_ | out-null
}
(& docker ps --quiet --filter 'status=exited' ) | Foreach-Object {
& docker rm $_ | out-null
}
@jrgcubano
jrgcubano / DbmlVS2017Fail.cs
Created January 31, 2018 15:03
Basic dbml dependencies in csproj vs2017 fail
<Compile Update="Model\SQLReadModel.cs">
<DependentUpon>SQLReadModel.dbml</DependentUpon>
</Compile>
<Compile Update="Model\SQLReadModel.designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>SQLReadModel.dbml</DependentUpon>
</Compile>
<Compile Update="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
@jrgcubano
jrgcubano / TypeExtensions.cs
Last active March 19, 2019 09:57
ValueObject and Reflection to get aggregate apply methods on static constructor
// Via https://github.com/eventflow/EventFlow/blob/e0f60416d3598117aa8c2c2dc706d42604eedbd1/Source/EventFlow/Aggregates/AggregateRoot.cs
public static class TypeExtensions
{
internal static IReadOnlyDictionary<Type, Action<T, IAggregateEvent>> GetAggregateEventApplyMethods<TAggregate, TIdentity, T>(this Type type)
where TAggregate : IAggregateRoot<TIdentity>
where TIdentity : IIdentity
{
var aggregateEventType = typeof(IAggregateEvent<TAggregate, TIdentity>);
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Scripting;
using Microsoft.CodeAnalysis.Scripting.CSharp;
namespace RoslynScriptingTest
{
@jrgcubano
jrgcubano / CmderZSH.md
Created January 5, 2018 10:21 — forked from dfontana/CmderZSH.md
My setup guide for installing Cgywin, Mintty, Cmder, and ZSH.

What's this?

Instructions to obtain ZSH on a windows environment, without the input funny business presented by some other attempted solutions.

The final result is ZSH running on a mintty terminal, emulated by cygwin, and being handled by the popular cmder.

Why is this here?

For the benefit of myself and others. I've already followed these instructions twice. It took me hours to figure all this out, maybe someone else can save a few.

What exactly is covered?

  • Installing and setting up cmder
@jrgcubano
jrgcubano / Readme.md
Last active January 3, 2018 19:45
Playing with multiple cake scripts

Run with:

.\build.ps1 -Script "pack.cake" -script="pack.cake" -verbosity="diagnostic"

Arguments for this case:

  • -Script is to specify running script
  • -script is to pass the argument