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 / CreateDateDimensionWithFiscals.sql
Created November 25, 2019 09:08 — forked from cgibson-dev/CreateDateDimensionWithFiscals.sql
A SQL script to create a Date dimension table with logic to specify fiscal dates.
BEGIN TRY
DROP TABLE [Dim].[Date]
END TRY
BEGIN CATCH
/*No Action*/
END CATCH
CREATE TABLE [Dim].[Date]
(
@jrgcubano
jrgcubano / AsyncInSync.cs
Created October 9, 2019 08:31
Throttling concurrent async tasks and Run async code in sync
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
namespace Ylp.Cms.Web.Infrastructure
{
public static class AsyncHelpers
{
/// <summary>
@jrgcubano
jrgcubano / DateTimeExtensions.cs
Created April 26, 2019 16:50
NodaTime InZone() and ToZone() conversion extension methods and sample usage.
public static class DateTimeExtensions
{
/// <summary>
/// Converts a non-local-time DateTime to a local-time DateTime based on the
/// specified timezone. The returned object will be of Unspecified DateTimeKind
/// which represents local time agnostic to servers timezone. To be used when
/// we want to convert UTC to local time somewhere in the world.
/// </summary>
/// <param name="dateTime">Non-local DateTime as UTC or Unspecified DateTimeKind.</param>
/// <param name="timezone">Timezone name (in TZDB format).</param>
@jrgcubano
jrgcubano / app.html
Created March 6, 2019 11:38 — forked from stoffeastrom/app.html
Aurelia Gist TypeScript Gestures Contextmenu
<template>
<require from="oa-contextmenu"></require>
<table oa-contextmenu.call="onContextmenu()">
<tr>
<td>Gesture me!!!</td>
</tr>
</table>
</template>
@jrgcubano
jrgcubano / index.html
Created February 28, 2019 09:37 — forked from fkleuver/index.html
Aurelia TypeScript - Popover
<!DOCTYPE html>
<html>
<head>
<title>Aurelia</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" type="text/css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bluebird/3.4.6/bluebird.min.js"></script>
</head>
<body aurelia-app="src/main">
/**
* Async iterators simple example.
*
* by Dmitry Soshnikov <[email protected]>
* MIT Style License, 2018
*/
async function* streamChunks() {
yield genChunk(1);
yield genChunk(2);
@jrgcubano
jrgcubano / publickey-git-error.markdown
Created January 28, 2019 11:17 — forked from adamjohnson/publickey-git-error.markdown
Fix "Permission denied (publickey)" error when pushing with Git

"Help, I keep getting a 'Permission Denied (publickey)' error when I push!"

This means, on your local machine, you haven't made any SSH keys. Not to worry. Here's how to fix:

  1. Open git bash (Use the Windows search. To find it, type "git bash") or the Mac Terminal. Pro Tip: You can use any *nix based command prompt (but not the default Windows Command Prompt!)
  2. Type cd ~/.ssh. This will take you to the root directory for Git (Likely C:\Users\[YOUR-USER-NAME]\.ssh\ on Windows)
  3. Within the .ssh folder, there should be these two files: id_rsa and id_rsa.pub. These are the files that tell your computer how to communicate with GitHub, BitBucket, or any other Git based service. Type ls to see a directory listing. If those two files don't show up, proceed to the next step. NOTE: Your SSH keys must be named id_rsa and id_rsa.pub in order for Git, GitHub, and BitBucket to recognize them by default.
  4. To create the SSH keys, type ssh-keygen -t rsa -C "[email protected]". Th
@jrgcubano
jrgcubano / search-git-history.md
Created January 2, 2019 09:14 — forked from lyoshenka/search-git-history.md
Search Git commit history for a string and see the diffs

Searching Git commit history

This should be one of the core features of Git, but for some reason it's impossible to figure out how to search for a string in your commit history and see the diffs that that string is in. Here's the best I've come up with:

To find which commits and which files a string was added or removed in:

git log -S'search string' --oneline --name-status

To see the diff of that

@jrgcubano
jrgcubano / .block
Created December 20, 2018 17:54 — forked from donmccurdy/.block
Google Maps + D3 Overlay
license: mit