Skip to content

Instantly share code, notes, and snippets.

View carloswm85's full-sized avatar
🎯
Compiling...

Carlos W. Mercado carloswm85

🎯
Compiling...
View GitHub Profile
Starting OmniSharp server at 5/20/2022, 10:58:08 AM
Target: c:\Users\carlo\source\repos\carloswm85-github\Ex_Files_C_Sharp_EssT_1\Exercise Files\CH02\02\Begin\LinkedIn.Essentials\LinkedIn.Essentials
OmniSharp server started.
Path: c:\Users\carlo\.vscode\extensions\ms-dotnettools.csharp-1.24.4-win32-x64\.omnisharp\1.38.3-beta.87\OmniSharp.exe
PID: 13440
[info]: OmniSharp.Stdio.Host
Starting OmniSharp on Windows 6.2.9200.0 (x64)
[info]: OmniSharp.Services.DotNetCliService
@carloswm85
carloswm85 / proxyswitcher.sh
Created June 8, 2022 00:01
Bash script functions for quickly setting and unsetting proxy configurations. Includes examples.
function proxy {
YW='\033[0;33m' # Yellow
NC='\033[0m' # No Color
SB='\033[1;34m' # Sky Blue
PP='\033[1;35m' # Purple
printf "\n${YW}How to set and unset proxy using Git Bash: ${NC}"
printf "\n${PP}Check:"
printf "\n${NC} $ git config --global --list"
printf "\n${PP}SET (Example):"
printf "\n${NC} $ http.proxy=http://username:password@proxyaddress:port"

This is the solution. Be sure that you've spent a good chanck of your time trying out your own approaches before using this solution.

-- 3. How many of each category of bikes do we have in our "Baldwin Bikes" store, which has the store_id of 2.
-- We need to see the name of the category as well as the number of bikes in the category.
-- Sort it by lowest numbers first. 
USE bike;
USE bike;
SELECT * FROM category;
SELECT * FROM product;
$(document).ready(function () {
// Variable assignment
var $producerSelect = $('#ProducersId');
$producerSelect.on('select2:select', function (e) {
var data = e.params.data;
var idPerson = data.id;
var dataWrapper = {
@carloswm85
carloswm85 / norepaint.js
Last active August 16, 2022 20:27
Saved as .js just for adding some color to it. No repainting function for Pinescript 5.0
//@version=5
// === No repainting.
f_nrp(_timeframe, _expression) =>
// request.security(symbol=syminfo.tickerid, timeframe=_timeframe, expression=_expression[barstate.isrealtime ? 1 : 0], gaps=barmerge.gaps_off)[barstate.isrealtime ? 0 : 1] // PineCoders best practice.
request.security(symbol=syminfo.tickerid, timeframe=_timeframe, expression=_expression[1], lookahead = barmerge.lookahead_on)
// Use
ema_expression = ta.ema(low, ema_length)
// Get values using anti-repainting
@carloswm85
carloswm85 / TransactionScope.cs
Created October 5, 2022 17:37
Saving multiple entities in one transaction using Entity Framework.
using (TransactionScope scope = new TransactionScope())
{
// TODO: Working on saving transaction
// Step 1
if (driver.id > 0) _unitOfWork.PersonRepository.Update(driver); else _unitOfWork.PersonRepository.Add(driver);
if (destination.id > 0) _unitOfWork.DestinationRepository.Update(destination); else _unitOfWork.DestinationRepository.Add(destination);
_unitOfWork.Save();
// Step 2
transportation.id_persona_transportista = driver.id;
Session["IdSesion"] = oExchangeData.IdSesion;
Session["NombreUsuario"] = oExchangeData.Nombre;
Session["IdUsuario"] = oExchangeData.IdUsuario;
Session["IdEmpresa"] = oExchangeData.Empresa;
int idSesion = Int32.Parse(Request["IdSesion"]);
System.Collections.ObjectModel.Collection<MiningGuide.Web.WebServicesAccessMiningPortal.Permisos> ListPermisos = oServicio.obtainModulosPermisosBySession(idSesion, 16);
List<int> ListaPermisos = new List<int>();
// 1) Recupero los permisos en el controlador a través de un web service
System.Collections.ObjectModel.Collection<ImportadorRegalias.WebServicesAccess.Permisos> ListPermisos = oServicio.obtainModulosPermisosBySession(idSesion, 16);
List<int> ListaPermisos = new List<int>();
foreach (ImportadorRegalias.WebServicesAccess.Permisos oPermiso in ListPermisos)
ListaPermisos.Add(oPermiso.IdModulo);
HttpContext.Current.Session["ListaPermiso"] = ListaPermisos;
@carloswm85
carloswm85 / IWebService.cs
Created December 1, 2022 17:46
Guías Miners web service interface
using Mining.Data.Entities;
using Mining.Data.Model;
using Mining.Service.Tools;
using System.Collections.Generic;
using System.Web;
namespace Mining.Service
{
public interface IWebService
{
public List<ExpedientesEstados> GetFileStatusList(int id = 0, int idRequestStatus = 0, int idSector = 0, string fileNumber = "")
{
if (id != 0) return _unitOfWork.ExpedientesEstadosRepository.GetAll().Where(e => e.id == id).ToList();
if (idRequestStatus != 0) return _unitOfWork.ExpedientesEstadosRepository.GetAll().Where(e => e.idEstadoSolicitud == idRequestStatus).ToList();
if (idSector != 0) return _unitOfWork.ExpedientesEstadosRepository.GetAll().Where(e => e.idSector == idSector).ToList();
if (fileNumber != "") return _unitOfWork.ExpedientesEstadosRepository.GetAll().Where(e => e.nroExpediente == fileNumber).ToList();
return _unitOfWork.ExpedientesEstadosRepository.GetAll().ToList();
}