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
#include <time.h>
int main()
{
clock_t begin = clock();
// Something here
clock_t end = clock();
double time_spent = (double)(end - begin) / CLOCKS_PER_SEC;
@abnerfcastro
abnerfcastro / navbar.html
Created June 28, 2017 23:50
Basic Bootstrap Navbar
<!-- Navbar -->
<nav class="navbar navbar-default">
<div class="container">
<div class="navbar-header">
<a href="#" class="navbar-brand">Koffee</a>
</div>
<ul class="nav navbar-nav">
<li><a href="#">About</a></li>
<li><a href="#">Contact</a></li>
</ul>
@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'
}, {
@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 / 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 / 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())

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 / 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">
@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')
public enum Nivel
{
Facil,
Medio,
Dificil
}
public class JogoAdivinhaNumero
{
public const int ValorMaximoNivelFacil = 10;