Skip to content

Instantly share code, notes, and snippets.

View lsauer's full-sized avatar
🎯
Focusing

Lorenz Lo Sauer lsauer

🎯
Focusing
View GitHub Profile
@lsauer
lsauer / 1backup_and_export_or_restore_and_import_bak_database.sql
Created December 6, 2013 22:42
Automated Microsoft MS SQL-Server / TSQL: backup and export or restore and import .bak Database backup files for attachment
/*www.technical-programming.com, lo sauer 2013
* description: Step by step process to load or save .bak Database backup files
* credits: RameshVel,Tim Partridge for the @fileListTable; StackOverflow
*/
/* Export/Save a Database Backup
See: http://technet.microsoft.com/en-us/library/ms186865.aspx
*/
BACKUP DATABASE logicalnameofthedatabase TO DISK = 'c:\physicalnameofthedatabase.bak'
@lsauer
lsauer / CodeAttribute.cs
Created November 27, 2013 21:26
C#: source-code header comments alternative by using attributes and runtime-reflection
//www.technical-programming.com, 2013 lo sauer
using System;
namespace MyProject.Attributes
{
public enum CodeAttributeName {
Author,
Copyright,
RevisionHistory,
License,
@lsauer
lsauer / check-data-type-of-a-field.sql
Created November 25, 2013 14:06
T-SQL: Error converting data type varchar to numeric; Procedure workaround
/* lsauer.com, 2013
* DECIMAL fields, declared as NOT NULL, cannot be filled by a simple empty string ''
* Insert '0.0' or '.0' instead
*/
CREATE PROCEDURE GetType(@TableName VARCHAR(100), @FieldName VARCHAR(100))
AS (SELECT system_type_id FROM sys.columns
WHERE object_id = OBJECT_ID(@TableName, 'U') AND name = @FieldName)
GO
EXECUTE GetType N'MyTable', N'MyTableField'
/*For instance: 106 is DECIMAL*/
@lsauer
lsauer / fake-picture-is-that-image-real.md
Last active December 29, 2015 04:19
Fake Pictures: Is that image real? The APEX rules for basic image verification on social networks

The APEX rules

check the credibility of socal media pictures

  • Author: check the stream/context of the original poster (OP), which conveys intent
  • Picture: check if the file is smaller than the norm and if it has metadata, such as Exif
  • Enhanced: check if what you are seeing is sensible and in physical agreement with your common sense
  • X-reference: check the image against an image datatabase, such as tineye.com

source: lsauer.com

@lsauer
lsauer / best-css-blockquote-styles.css
Last active June 5, 2018 14:03
Best CSS blockquote styles / designs for HTML5 websites
/*www.lsauer.com, lo sauer 2013
*/
@media screen {
blockquote {
display: block;
margin: 1.5em 0 1.5em -1.5em;
padding: .75em .5em .75em 1em;
background: #fff;
border-left: 0.5em solid #DDD;
font-size: 1em;
@lsauer
lsauer / blogger-footer-label-tags-design-on-top.css
Last active December 27, 2015 16:49
Blogger-plugin: social-share buttons on top and modern CSS Label styles
@lsauer
lsauer / blogger-footer-label-tags-design.css
Created November 7, 2013 15:54
CSS Label styles / designs for the Blogger article-footer
@lsauer
lsauer / google-blogger-reinject-javascript.js
Last active December 27, 2015 15:19
JavaScript: Read TextContent from a tag and re-inject it as a HTML Script Element (blogger-plugins)
//www.lsauer.com, lo sauer 2013
//descr: looks for <code tags> and reinjects their content as a <script> Element;
// allows XHTML compliance with CDATA Containers
//from is-lib: DOMInsertScript
/* add this somewhere in your Blogger template*/
var bloggerplugins = bloggerplugins || {};
bloggerplugins.codetoscript = (function($, allowTextnode){
return function(){
var DOMInsertScript = function (str, toel) {
@lsauer
lsauer / google-blogger-gistloader.js
Last active December 27, 2015 08:29
Load github's embedded-gists in Google Blogger's Dynamic View templates, automatically
// http://www.lsauer.com, lo sauer 2013
//descr: load embedded-gists in Google Blogger's Dynamic View templates
//credits: https://github.com/kares/script.js for 'script.js' a helper to readout script's contents
//depends: jQuery to some extend, but dependence can be easily removed
//usage: e.g. following HTML can be used to load gists:
// <code data-src="https://gist.github.com/lsauer/6397381.js">Loading ....</code>
// <code data-src="https://gist.github.com/lsauer/2836373.js">Loading ....</code>
var timeoutfnLoadgist = function() {
var out = {};
@lsauer
lsauer / copy-and-paste-refer-to-new-location.js
Last active December 27, 2015 06:49
JavaScript : Copy text to the clipboard, without Flash and securely with subsequent url-change
//www.lsauer.com, lo sauer 2013
//see: http://www.lsauer.com/2012/05/javascript-copy-text-to-clipboard.html
var keypressHandlerForwardLocation = function(evt){
if(evt instanceof KeyboardEvent && evt.target instanceof HTMLElement
&& evt.keyCode == 99 && evt.ctrlKey==true && evt.target != null
&& (evt.target.innerText || evt.target.value).Trim().substr(0,4) == "http"){
cancelBubble = true;
window.location = (evt.target.innerText || evt.target.value).Trim();
}
}