Skip to content

Instantly share code, notes, and snippets.

View abnerfcastro's full-sized avatar
📚
Always Learning

Abner Castro abnerfcastro

📚
Always Learning
  • Sýn / Vodafone Iceland
  • Brazil
View GitHub Profile
@abnerfcastro
abnerfcastro / Program.cs
Last active June 20, 2019 20:16
Treinamento C# - CRUD
using System;
using System.Data.SqlClient;
using System.Threading;
namespace Treinamento.Banco.Console
{
public static class Usuario
{
public static readonly string Id = "Id";
public static readonly string Nome = "Nome";
@abnerfcastro
abnerfcastro / gist:8c086be5a7824ba505b307ecb973f9d4
Created June 18, 2019 01:10 — forked from sabarasaba/gist:3080590
Remove directory from remote repository after adding them to .gitignore
git rm -r --cached node_modules
git commit -m 'Remove the now ignored directory node_modules'
git push origin master
public enum Nivel
{
Facil,
Medio,
Dificil
}
public class JogoAdivinhaNumero
{
public const int ValorMaximoNivelFacil = 10;
@abnerfcastro
abnerfcastro / merge.sql
Created November 14, 2018 12:02
Merging Tables in SQL Server
CREATE TABLE #SOURCE (
SOURCE_FIELD VARCHAR(30) NOT NULL
)
CREATE TABLE #TARGET (
TARGET_FIELD VARCHAR(30) NOT NULL
)
INSERT INTO #SOURCE VALUES ('Apple'), ('Strawberry'), ('Orange'), ('Kiwi')
INSERT INTO #TARGET VALUES ('Apple'), ('Orange')
@abnerfcastro
abnerfcastro / google-signin-button[pt-Br].md
Last active February 14, 2018 16:30
Google Sign Button [pt-Br]

Google Sign-in Button in Portuguese

Following the guidelines provided in Sign-In Branding Guidelines.

Credits to Tim Layton - available on Codepen.

Remember to include Roboto font.

<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">

Snippet to get started

// IIFE - Immediately Invoked Function Expression
(function($, window, document) {

    // The $ is now locally scoped 

    // Listen for the jQuery ready event on the document
 $(function() {
@abnerfcastro
abnerfcastro / Program.cs
Last active December 7, 2017 19:52
Extension Methods in C#
using System;
using System.Collections;
using System.Text.RegularExpressions;
public class Program
{
public static void Main()
{
var email = "abnerfcastro@gmail.com";
if (email.IsValidEmailAddress())
@abnerfcastro
abnerfcastro / Params.cs
Last active December 5, 2017 14:24
Using params keyword in C#
using System;
public class Program
{
public static void Main()
{
Console.WriteLine(Sum(1, 2, 3, 4, 5));
Console.WriteLine(SumWithoutParams(new int[] {1, 2, 3, 4, 5}));
}
@abnerfcastro
abnerfcastro / delegates.cs
Last active September 29, 2017 18:45
Delegates and Events on C#
using System;
namespace Delegates
{
public class PriceChangedEventArgs : EventArgs
{
public readonly decimal LastPrice;
public readonly decimal NewPrice;
public PriceChangedEventArgs(decimal lastPrice, decimal newPrice)
@abnerfcastro
abnerfcastro / app.js
Created September 1, 2017 00:25
Custom HTTP Error Handling for ExpressJS
const express = require('express');
const app = express();
const _ = require('lodash');
const HttpErrors = require('./http-errors');
const users = [{
id: 1,
name: 'John Snow'
}, {