Skip to content

Instantly share code, notes, and snippets.

View webgio's full-sized avatar

Giorgio Bozio webgio

  • Viva Software
  • Italy
View GitHub Profile
@webgio
webgio / fulltext_status.sql
Last active August 8, 2019 13:47
How do I list all tables / columns in my SQL server / Azure database that have a full-text index
SELECT name, case FULLTEXTCATALOGPROPERTY(name, 'PopulateStatus')
when 0 then 'Idle'
when 1 then ' Full population in progress'
when 2 then ' Paused'
when 3 then ' Throttled'
when 4 then ' Recovering'
when 5 then ' Shutdown'
when 6 then ' Incremental population in progress'
when 7 then ' Building index'
when 8 then ' Disk is full. Paused.'
@webgio
webgio / dapperRun.cs
Last active June 9, 2017 09:27
run with dapper (and NHibernate session and ransaction)
public void RunInSql(Action<IDbConnection, IDbTransaction> action)
{
using (var connection = session.Connection)
{
using (var transaction = GetTransaction(session))
{
try
{
action(connection, transaction);
transaction.Commit();
[{
"title": "First Block",
"images": [
"https://1.img-dpreview.com/files/p/TS1200x900~sample_galleries/4783759740/0935322774.jpg"
, "https://3.img-dpreview.com/files/p/TS1200x900~sample_galleries/4783759740/7732391852.jpg"
, "https://1.img-dpreview.com/files/p/TS1200x900~sample_galleries/4783759740/6412900034.jpg"
]
},
{
"title": "Second Block",
@webgio
webgio / index.html
Created April 4, 2017 15:26
Backbone DEMO Backbone JS Demo // source http://jsbin.com/cihimiq
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="Backbone JS Demo" />
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.4.4/underscore-min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/backbone.js/1.0.0/backbone-min.js"></script>
<meta charset=utf-8 />
<title>Backbone DEMO</title>
@webgio
webgio / hof.cs
Last active January 26, 2017 09:55
High order function in C#
void Main()
{
var add4To = AddNumber(4);
var newNumber = add4To(3);
Console.WriteLine(newNumber);
// prints 7
}
public Func<int, int> AddNumber(int n)
{
public static bool PdfContains(byte[] pdfcontent, string text)
{
using (var pdfReader = new PdfReader(pdfcontent))
{
for (int page = 1; page <= pdfReader.NumberOfPages; page++)
{
var strategy = new SimpleTextExtractionStrategy();
string currentText = PdfTextExtractor.GetTextFromPage(
pdfReader, page, strategy);
@webgio
webgio / RotativaHQ_header_footer.cs
Last active September 3, 2016 13:45
RotativaHQ header and footer
*.o *.lo *.la *.al .libs *.so *.so.[0-9]* *.a *.pyc *.pyo __pycache__ *.rej *~ #*# .#* .*.swp .DS_Store Packages packages bin obj *.suo *.user
@webgio
webgio / shrink
Last active August 29, 2015 14:00
T-SQL query to get tables size
SELECT
t.NAME AS TableName,
s.Name AS SchemaName,
p.rows AS RowCounts,
SUM(a.total_pages) * 8 AS TotalSpaceKB,
SUM(a.used_pages) * 8 AS UsedSpaceKB,
(SUM(a.total_pages) - SUM(a.used_pages)) * 8 AS UnusedSpaceKB
FROM
sys.tables t
INNER JOIN
@webgio
webgio / index.html
Last active December 17, 2015 22:59
coffee pastry widget
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="js/lib/jquery.js"></script>
<script type="text/javascript" src="js/lib/underscore-min.js"></script>
<script type="text/javascript" src="js/lib/backbone.js"></script>
<script type="text/javascript" src="js/lib/backbone.marionette.js"></script>
<script type="text/javascript" src="js/lib/handlebars.js"></script>
<script type="text/javascript" src="js/widget.js"></script>
<title>testing widget</title>