Skip to content

Instantly share code, notes, and snippets.

View JCKodel's full-sized avatar
💭
GitHub trying to make a social network for the most antisocial people O.o

J.C.Ködel JCKodel

💭
GitHub trying to make a social network for the most antisocial people O.o
View GitHub Profile
@JCKodel
JCKodel / designer.html
Created August 22, 2014 17:11
designer
<link rel="import" href="../components/polymer/polymer.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
width: 100%;
height: 100%;
Press enter to begin the benchmark:
Results
=======
Framework Entities Insert Update Delete Single Fetch Paged
---------------------------------------------------------------------------------------------------------------
DapperExtensionsAsync 1.40/1.4.3: 1 17,69 ms 17,07 ms 17,40 ms 1,43 ms 1,22 ms 1,28 ms
DapperExtensionsAsync 1.40/1.4.3: 25 23,50 ms 21,74 ms 18,32 ms 3,60 ms 1,47 ms 1,41 ms
DapperExtensionsAsync 1.40/1.4.3: 50 24,64 ms 37,30 ms 22,95 ms 5,79 ms 1,91 ms 1,69 ms
<#@ output extension=".cs" #>
<#@ assembly name="System.Core" #>
<#@ assembly name="System.Data" #>
<#@ import namespace="System.Collections.Generic" #>
<#@ import namespace="System.Data" #>
<#@ import namespace="System.Data.SqlClient" #>
// ReSharper disable All
using System;
using System.Data.SqlClient;
using System.Collections.Generic;
<#
var connectionString = "Data Source=.;Initial Catalog=NomeBanco;Integrated Security=True"; // String de conexão do banco local contendo as procs
var databaseName = "AdminDataClient"; // Nome da interface e classe (Foo cria a interface IFoo e a classe concreta Foo)
var ns = "Dados"; // Namespace onde as classes de entrada, saída e client serão geradas (geralmente o namespace do projeto atual)
var schemaFilter = "admin"; // Filtra apenas procedures pertencentes a este schema
#>
<#@ include file="ModelGenerator.ttinclude" #>
{"swagger":"2.0","info":{"version":"1.0.0","title":"Notícias","description":"Canal de notícias globo.com"},"host":"recomendacao.globo.com","schemes":["http"],"produces":["application/json"],"paths":{"/rec/v2/user/gshow/feed":{"get":{"description":"Retorna uma lista de notícias recomendadas","produces":["application/json"],"responses":{"200":{"description":"Página contendo a lista de notícias recomendadas","schema":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string"},"mainSection":{"type":"string"},"mainSectionPermalink":{"type":"string"},"issued":{"type":"string"},"caption":{"type":"string"},"title":{"type":"string"},"type":{"type":"string"},"photos":{"type":"object","properties":{"original":{"type":"string"},"thumbnail":{"type":"string"}}}}}}}}}}}}
using System;
namespace Pools
{
public abstract class GenericPool<T> : IDisposable where T : class
{
public abstract void Dispose();
private T _instance;
@JCKodel
JCKodel / routes.js
Created June 22, 2018 20:22
Intercept Framework7 routes for authentication
import EventBus from "@/eventBus"; // A simple new Vue() event bus
import store from "@/store";
import HomePage from "./pages/index.vue";
import NotFoundPage from "./pages/404.vue";
import CustomersHomePage from "./pages/customers/index.vue";
import CustomersCategoriesPage from "./pages/customers/categories.vue";
const routes =
[
{
@JCKodel
JCKodel / DictionaryPerformanceUnitTest.cs
Last active November 5, 2023 20:23
6 methods of multithread Dictionary manipulation benchmark
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
// 66ms: Dictionary with lock()
// 78ms: Dictionary with ReaderWriterLockSlim
// 128ms: ConcurrentDictionary (with Add if not exists)
@JCKodel
JCKodel / TablesLastUpdates.sql
Created August 20, 2018 23:09
Obtendo a última data de alteração de cada tabela
SELECT
q.tableName
,MAX(q.lastUpdate) AS lastUpdate
FROM
(
SELECT
s.name + '.' + t.name AS tableName
,ISNULL(u.last_user_update, '2000-01-01') AS lastUpdate
FROM sys.tables AS t
INNER JOIN sys.schemas AS s ON s.schema_id = t.schema_id
@JCKodel
JCKodel / ProcedureDependencies.sql
Created August 20, 2018 23:12
Obtendo uma lista de dependências de um procedure
SELECT
s.name + '.' + p.name AS procedureName
,(
SELECT DISTINCT
STUFF(REPLACE((SELECT '#!' + LTRIM(RTRIM(q.tableName)) AS 'data()'
FROM
(
SELECT DISTINCT
ts.name + '.' + t.name AS tableName
FROM sys.dm_sql_referenced_entities(s.name + '.' + p.name, 'OBJECT') AS r