Skip to content

Instantly share code, notes, and snippets.


Javier Lozano jglozano

View GitHub Profile
jglozano / AccessFilter.cs
Created Jan 21, 2022
Reading Body from HttpRequest
View AccessFilter.cs
// snippet around reading from HttpRequest.Body
var request = context.Request;
// deserialize into temp structure using System.Text.Json.JsonSeralizer
var temp = await JsonSerializer.DeserializeAsync<RequestTemp>(request.Body,
options: new JsonSerializerOptions { PropertyNameCaseInsensitive = true });
request.Body.Seek(0, SeekOrigin.Begin);
jglozano /
Created Oct 12, 2019
Git Refresh - Create Temp Files
for d in {1..6}; do touch "file${d}.md"; git add "file${d}.md"; git commit -m "adding file ${d}"; done
jglozano /
Last active Aug 30, 2018
Git log oneline with a pretty graph

The following alias, lol creates a clean, reable graph of the commits using the git log command as the base:

git config --global 'log --oneline --graph --decorate --all'

jglozano / GetNextIdAsync.cs
Created Mar 2, 2018
Get Next ID from Sequence / StoredProc
View GetNextIdAsync.cs
public async Task<int> GetNextIdAsync()
using (var connection = GetDbConnection())
var parameters = new DynamicParameters();
parameters.Add("@nextId", dbType: DbType.Int32, direction: ParameterDirection.ReturnValue);
await connection.ExecuteAsync("[Schema].[sp_GetNextId]", parameters, commandType: CommandType.StoredProcedure).ConfigureAwait(false);
var result = parameters.Get<int>("@nextId");
jglozano / ConfigCorsPolicyProvider.cs
Created Feb 12, 2018
Configuration CORS Policy Provider
View ConfigCorsPolicyProvider.cs
public class ConfigCorsPolicyProvider : ICorsPolicyProvider
private readonly IConfigurationService configurationService;
public ConfigCorsPolicyProvider(IConfigurationService configurationService)
this.configurationService = configurationService;
public Task<CorsPolicy> GetCorsPolicyAsync(HttpRequestMessage request, CancellationToken cancellationToken)
View BrowserJsonFormatter.cs
public class BrowserJsonFormatter : JsonMediaTypeFormatter
public BrowserJsonFormatter()
SupportedMediaTypes.Add(new MediaTypeHeaderValue("text/html"));
SerializerSettings.Formatting = Formatting.Indented;
public override void SetDefaultContentHeaders(Type type, HttpContentHeaders headers, MediaTypeHeaderValue mediaType)
jglozano /
Last active Feb 9, 2018
Beyond Compare Git Diff/Merge Setup


git config --global diff.tool bc3 git config --global difftool.bc3.path "c:/Program Files/Beyond Compare 4/bcomp.exe"

3way Merge

git config --global merge.tool bc3 git config --global mergetool.bc3.path "c:/Program Files/Beyond Compare 4/bcomp.exe"

jglozano / .bash_profile
Last active Jan 27, 2021
bash profile that adds support for Git
View .bash_profile
# get current branch in git repo
function parse_git_branch() {
BRANCH=`git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'`
if [ ! "${BRANCH}" == "" ]
echo "[${BRANCH}${STAT}]"
echo ""

Keybase proof

I hereby claim:

  • I am jglozano on github.
  • I am jglozano ( on keybase.
  • I have a public key ASCh5cu0AuLkPCJghJpboKjNfcHPbnHNhbjs3fjGHq10cwo

To claim this, I am signing this object:

View Luke.txt
In those days a decree went out from Caesar Augustus that the whole world should be enrolled. This was the first enrollment, when Quirinius was governor of Syria. So all went to be enrolled, each to his own town. And Joseph too went up from Galilee from the town of Nazareth to Judea, to the city of David that is called Bethlehem, because he was of the house and family of David, to be enrolled with Mary, his betrothed, who was with child. While they were there, the time came for her to have her child, and she gave birth to her firstborn son. She wrapped him in swaddling clothes and laid him in a manger, because there was no room for them in the inn. Now there were shepherds in that region living in the fields and keeping the night watch over their flock. The angel of the Lord appeared to them and the glory of the Lord shone around them, and they were struck with great fear. The angel said to them, “Do not be afraid; for behold, I proclaim to you good news of great joy that will be for all the people. For today