Skip to content

Instantly share code, notes, and snippets.

View jflopezfernandez's full-sized avatar
🏈
Merry Start of the Football Season Eve!!!

Jose Fernando Lopez Fernandez jflopezfernandez

🏈
Merry Start of the Football Season Eve!!!
View GitHub Profile
@jflopezfernandez
jflopezfernandez / named-type.h
Last active November 6, 2018 15:33
Named Value Implementation in C++ Using Templates
// --------------------------------------------------------------------------------------------------------------------
//
// Author: Jose Fernando Lopez
// Date: 6-November-2018
//
// Description: This is a sample of how a named value might be implemented using a templated class in C++.
// I will update the constructor with proper move-semantics, add a copy constructor, etc., as
// well as add in string_view usage. I also need to add in operators in order for the value
// to be actually used.
@jflopezfernandez
jflopezfernandez / log-function-macro.h
Created November 6, 2018 19:33
MSVC - Print current function to log
// ---------------------------------------------------------------------------------------------------------
//
// Author: Jose Fernando Lopez Fernandez
// Date: 6-November-2018
//
// Description: Logs the current function to std::clog. Simple inline function won't work for obvious reasons,
// so this is a workaround to not have to fire up the actual debugger and check the call stack.
// The function call format is for homogeneity in the code, while preventing confusion by explicitly
// including the fact that it is a macro in the name.
@jflopezfernandez
jflopezfernandez / wrapper.h
Created November 6, 2018 19:34
Function Call Wrapper
//
template <typename Callable, typename... Args>
decltype(auto) Call(Callable&& op, Args&&... args)
{
//DoSomethingElseLikePossiblyLoggingOrSomething...
return std::forward<Callable>(op)(std::forward<Args>(args)...);
}
@jflopezfernandez
jflopezfernandez / regex-numerical-constants.pl
Created November 21, 2018 19:24
Regular Expression for Parsing Numerical Constants
# Author: Jose Fernando Lopez Fernandez
# Date : 21-November-2018
/-?\s?\d+(?(?=\.)\.|\d*)/
#! /usr/bin/perl
# Uses file existence operator to test whether specified directory already exists.
# Directory name input mechanism is not assumed; trivial example provided.
#
# Author: Jose Fernando Lopez Fernandez
# Date: 21-November-2018
#
# Note: "say" function requires "use v5.10" or higher
@jflopezfernandez
jflopezfernandez / Powerset.hs
Created November 24, 2018 21:50
Generate the powerset of a list or set
import Control.Monad
set' :: [Integer]
set' = [1,2,3]
main :: IO ()
main = do
@jflopezfernandez
jflopezfernandez / Generate random string
Created January 1, 2019 14:13
Generate random string on the command line using ruby
ruby -rsecurerandom -e 'puts SecureRandom.hex(20)'
@jflopezfernandez
jflopezfernandez / ActionDelegate.cs
Created January 14, 2019 06:56
Action delegate and a type alias in C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ActionAndFuncDelegates
{
using DisplayMessageAction = Action<string, ConsoleColor, int>;
@jflopezfernandez
jflopezfernandez / WindowsGodMode
Created January 14, 2019 15:51
Enable windows god mode
GodMode.{ED7BA470-8E54-465E-825C-99712043E01C}
@jflopezfernandez
jflopezfernandez / packages.config
Created January 14, 2019 23:28
Nugest configuration
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Azure.KeyVault" version="2.3.2" targetFramework="net472" />
<package id="Microsoft.Azure.KeyVault.WebKey" version="2.0.7" targetFramework="net472" />
<package id="Microsoft.Azure.Services.AppAuthentication" version="1.0.1" targetFramework="net472" />
<package id="Microsoft.Extensions.Configuration" version="2.2.0" targetFramework="net472" />
<package id="Microsoft.Extensions.Configuration.Abstractions" version="2.2.0" targetFramework="net472" />
<package id="Microsoft.Extensions.Configuration.AzureKeyVault" version="2.2.0" targetFramework="net472" />
<package id="Microsoft.Extensions.Configuration.Binder" version="2.2.0" targetFramework="net472" />
<package id="Microsoft.Extensions.Configuration.CommandLine" version="2.2.0" targetFramework="net472" />