Skip to content

Instantly share code, notes, and snippets.

Avatar

Sebastiano SebastianGaud

View GitHub Profile
@SebastianGaud
SebastianGaud / ClassGenerator.sql
Created Nov 28, 2019 — forked from ernado-x/ClassGenerator.sql
Generate C# class from database table
View ClassGenerator.sql
--from SO: http://stackoverflow.com/questions/5873170/generate-class-from-database-table
declare @TableName sysname = 'TableName'
declare @Result varchar(max) = 'public class ' + @TableName + '
{'
select @Result = @Result + '
public ' + ColumnType + NullableSign + ' ' + ColumnName + ' { get; set; }
'
from
View strike.html
<style>
.strike {
display: block;
text-align: center;
overflow: hidden;
white-space: nowrap;
}
.strike > span {
position: relative;
@SebastianGaud
SebastianGaud / date.getWeek.js
Created Feb 7, 2019
javascript, js, getWeek
View date.getWeek.js
/**
* Returns the week number for this date. dowOffset is the day of week the week
* "starts" on for your locale - it can be from 0 to 6. If dowOffset is 1 (Monday),
* the week returned is the ISO 8601 week number.
* @param int dowOffset
* @return int
*/
Date.prototype.getWeek = function (dowOffset) {
/*getWeek() was developed by Nick Baicoianu at MeanFreePath: http://www.meanfreepath.com */
@SebastianGaud
SebastianGaud / JS-LINQ.js
Created Jul 13, 2018 — forked from DanDiplo/JS-LINQ.js
JavaScript equivalents of some common C# LINQ methods. To help me remember!
View JS-LINQ.js
// JS array equivalents to C# LINQ methods - by Dan B.
// Here's a simple array of "person" objects
var people = [
{ name: "John", age: 20 },
{ name: "Mary", age: 35 },
{ name: "Arthur", age: 78 },
{ name: "Mike", age: 27 },
{ name: "Judy", age: 42 },
{ name: "Tim", age: 8 }
View github-markdown-print.js
// Refrence from: https://gist.github.com/beevelop/a0f2c76e79610dca01550c9a93f83876
// Copy following scripts in the developer console of page included markdown content you want to print:
(function () {
var $ = document.querySelector.bind(document);
$('#readme').setAttribute('style', 'position:absolute;top:0;left:0;right:0;bottom:0;z-index:100;background-color:white');
$('#readme>article').setAttribute('style', 'border: none');
$('body').innerHTML = $('#readme').outerHTML;
window.print();
})();
View sensehatPrintInformation.py
# This file has been written to your home directory for convenience. It is
# saved as "/home/pi/temperature-2017-10-12-13-53-36.py"
import time
import threading
import csv
import datetime
from sense_emu import SenseHat
brake = 1
@SebastianGaud
SebastianGaud / SendTelegramMessageWithGetUpdates.cs
Created May 10, 2017
Retrieve Chat Id from getUpdates and send a Message to the first recipient
View SendTelegramMessageWithGetUpdates.cs
public static void Main(string[] args)
{
List<Result> result = MakeRequest().Result;
SendMessage(result);
Console.Read();
}
public static async void SendMessage(List<Result> result)
@SebastianGaud
SebastianGaud / SendEmail.cs
Created Apr 16, 2017
Send Email in C# through google
View SendEmail.cs
public static void CreateTestMessage4 ( string server )
{
MailAddress from = new MailAddress( "senderemail" );
MailAddress to = new MailAddress( "recipientemail" );
MailMessage message = new MailMessage( from , to );
System.Net.Mail.Attachment attachment = new System.Net.Mail.Attachment( Environment.CurrentDirectory + "/file.pdf" );
var smtp = new SmtpClient
You can’t perform that action at this time.