Skip to content

Instantly share code, notes, and snippets.

View fcmendoza's full-sized avatar
💭
My future look cloud-y

Fernando Mendoza fcmendoza

💭
My future look cloud-y
View GitHub Profile
# See comments for examples
@fcmendoza
fcmendoza / gogogo.go
Created May 9, 2019 19:44
Go Go Power Rangers
// See comments for examples.
@fcmendoza
fcmendoza / get_git.sh
Last active April 18, 2022 16:09
Geet Get Git
# See comments for examples
@fcmendoza
fcmendoza / main.tf
Last active December 23, 2018 18:40
Create EC2 instance via Terraform
provider "aws" {
access_key = "YOURACCESSKEYHERE"
secret_key = "YOURSECRETKEYHERE"
region = "us-west-1"
}
resource "aws_instance" "example" {
ami = "ami-00048435fed26a8d1" # Ubuntu 14.04 LTS
instance_type = "t2.micro"
key_name = "my_keypair"
@fcmendoza
fcmendoza / 01_rebuild_custom.ps1
Last active September 4, 2017 23:04
Powershell script to "hard" rebuild a Visual Studio solution
cls
ECHO "Hard rebuilding 'Main' solution. Go get some coffee, this is going to take a few minutes ..."
$stopWatch = [system.diagnostics.stopwatch]::startNew()
ECHO "Cleaning solution ..."
devenv C:\Projects\Main.sln /clean
ECHO "Deleting remaining contents in bin folders ..."
@fcmendoza
fcmendoza / funcs.cs
Last active April 5, 2016 16:26
Understanding how Func<T> works.
using System;
public class Program
{
public static void Main() {
new Functions().Start();
}
}
public class Functions
public class PoorContainer {
public void Register<T>(T t) {
types.Add(typeof(T), t);
}
public T Resolve<T>() {
return (T)types[typeof(T)];
}
private readonly Dictionary<Type, object> types = new Dictionary<Type, object>();
private void SaveWhiteBlackListDataImportFile(IEnumerable<PartInfoImportFile> parts, int userID)
{
using (var sqlConnection = new SqlConnection(_connectionString))
{
sqlConnection.Open();
using (var multi = sqlConnection.QueryMultiple("dbo.SavePartInfoImportFileData",
new PartInfoDynamicParam("ParameterTable", parts, userID),
commandType: CommandType.StoredProcedure, commandTimeout: 120)) {
}
@fcmendoza
fcmendoza / XmlToSqlWithAttributes.sql
Last active August 29, 2015 14:13
Parse XML to SQL with attributes
declare @NotesXml xml =
'<root>
<Notes CreationDate="01/18/2015" Note="Note 1" UserID="10"/>
<Notes CreationDate="01/18/2015" Note="Note 2" UserID="20"/>
</root>'
declare @notesTable as table (
CreationDate datetime,
Note varchar(max),
UserID int
@fcmendoza
fcmendoza / each.js
Last active August 29, 2015 14:12
jQuery samples
// This code gets all textboxes with the 'required' class and
// executes a method for those that don't have a value.
$(":text .required" ).each(function( index, element ) {
var self = this;
var labelText = $('label[for=' + self.id + ']').text();
if (element.val() == "") {
message("Please fill " + labelText, "#" + self.id);
return false;